I am simply trying to add a list validation to a cell and I am getting Runtime Error 1004 Application-defined or Object-defined Error. I have this exact code validating a cell elsewhere in my workbook and it has never had an issue.
With Range("Q3").Validation
.Delete
.Add _
Type:=xlValidateList, _
AlertStyle:=xlValidAlertStop, _
Formula1:="=Constants!Q6:Q30"
End With
I have also tried using the string "Alice,Bob" for Formula1 and I get the same error so this is not the issue. In fact, I am only seeing this error when trying to set any sort of validation (same error with xlValidateWholeNumber for instance) on this particular worksheet.
Some info that may or may not be relevant:
- The worksheet is unprotected and screenupdating is off when I try to set this validation
- The above is contained on a CommandButton_Click event on said worksheet
- All CommandButtons in the workbook have TakeFocusOnClick = False
- This is Microsoft Office 2013
