charts - VBA Data Validation from another worksheet -
charts - VBA Data Validation from another worksheet -
i have 2 worksheets. sheet1 , sheet3. in sheet3, have multiple publicly traded companies going across first row. under each company, have chart/graph name able find through workbook relevant company.
in sheet1, have column of companies , column graph. want create drop downwards list allow user select graph , open in pdf or expanded version. how go doing this?
sub appendgraphs() dim source, target worksheet dim lc, rc integer set source = sheet5 set target = sheet1 lc = source.cells(1, columns.count).end(xltoleft).column = 2 lc ' collect strings each column , store templist feed datavalidation rc = source.cells(rows.count, i).end(xlup).row redim templist(1 rc) string n = 2 ubound(templist) templist(n) = source.cells(i, n).value target.cells(findrowb(source.cells(1, i).value, sheet1), 10).validation .delete .add type:=xlvalidatelist, alertstyle:=xlvalidalertstop, _ operator:=xlbetween, formula1:=templist .ignoreblank = true .incelldropdown = true .inputtitle = "" .errortitle = "" .inputmessage = "" .errormessage = "" .showinput = true .showerror = true end next next
end sub
function findrowb(x string, optional y worksheet) integer 'finds specific row start writing values in dim expectedrow range dim wbsheet worksheet if y nil set wbsheet = activesheet else set wbsheet = y end if set expectedrow = wbsheet.range("c:c").find(what:=x, lookin:=xlvalues, lookat:=xlwhole) findrowb = expectedrow.row
end function
no 1 vba you. google each part individually, here started.
create drop down, https://support.office.com/en-us/article/create-a-dropdown-list-7693307a-59ef-400a-b769-c5402dce407b
link it, http://software-solutions-online.com/2014/02/21/excel-vba-drop-down-lists/
save pdf, http://www.contextures.com/excelvbapdf.html
google friend!
or utilize record macro.
feel free inquire questions.
vba charts
Comments
Post a Comment