excel vba - How to extend a formula in VBA past 1 line of code -
so not have experience programming , non vba. main issue formula in code extends past 1 line , when include underscore, space , start new line, receive error.
i have attached pic of code, there unnecessary lines of code because recorded macro code.
more information on trying do:
i have list contained in cell using "data validation" , based on selection list, cell below output list.
the information these lists stored on other worksheets in workbook.
i able develop if statement in "data validation" list source box worked several inputs. have 84 possibilities , not fit individual if statements in list source box. therefore decided try , manually input formula using vba recording macro of several input "data validation" if statement.
here code:
sub helpsetup() selection.validation .delete .add type:=xlvalidatelist, alertstyle:=xlvalidalertstop, operator:= _ xlbetween, formula1:= _ "=if($b$2='fuel columns'!$a$1,agriculturalbiproduct,if($b$2='fuel columns'!$b$1,agriculturalresidue,if($b$2='fuel columns'!$c$1,agriculturalwaste,nofuel)))" .ignoreblank = true .incelldropdown = true .inputtitle = "" .errortitle = "" .inputmessage = "" .errormessage = "" .showinput = true .showerror = true end end sub
when have long bit of text squeeze in, need break chunks using "&" , _.
like this
dim astring string
astring = "four score , 7 years ago our fathers " & _ "set forth on continent new nation, " & _ "conceived in liberty , dedicated " & _ "proposition men created equal."
be sure leave space between & , _.
smw
Comments
Post a Comment