So I do not have too much experience with programming and almost non with VBA. My main issue is that the formula in my code extends past 1 line and when I include an underscore, space and then start a new line, I receive an error.
I have attached a pic of the code, there is probably unnecessary lines of code because I recorded a macro to get the code.
More information on what I am trying to do:
I have a list contained in a cell using "data validation" and based on the selection from that list, the cell below will output a certain list.
The information for these lists are stored on other worksheets in the workbook.
I was able to develop an IF statement in the "data validation" list source box that worked for several inputs. However I have 84 possibilities and i could not fit all the individual if statements in the list source box. Therefore I decided to try and manually input the formula using VBA by recording a macro of the several input "data validation" if statement.
Here is the code:
Sub HelpSetUp()
With 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 With
End Sub