Thanks everyone for the replies. I've made a lot of progress. The problem was a combination of needing to double my quotes and seperate the formula into a named range.
There is still one section of code which isn't working. The error message is:
Run-time error '1004'.
Application-defined or object-defined error.
The code is the following, with the error in bold:
Columns("D:D").Select
ActiveWorkbook.Names.Add Name:="myNamedRange4", RefersTo:="=OFFSET(KeywordStart,MATCH(C1,KeywordColumn,0)-1,1,COUNTIF(KeywordColumn,C1),1)"
With Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=myNamedRange4"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
Do any of you have any ideas what might be causing this?
Thanks again!
EDIT: I have attached all my code if that will make debugging easier