Hi Everyone,
Got a bit of a problem and I have been racking my brains out over it!
Essentially the problem is this:
I want to be able to create validation drop-down boxes dynamically, say for instance, when a commandbutton is pressed. Code is:
With Range("E2").Validation
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=$A$30:$A$50"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
However, this generates an error message (when you run it from a commandbutton). If you run it using the debug window, everything is just fine!
One possible solution is that I just use a 'Button' from the forms menu, and attach the macro to it. I would prefer not too, as this substantially reduces the capabilities of the program.
Does anyone have any solutions to this problem, or even reasons for it's occurance?
Thank you,
Nick
Got a bit of a problem and I have been racking my brains out over it!
Essentially the problem is this:
I want to be able to create validation drop-down boxes dynamically, say for instance, when a commandbutton is pressed. Code is:
With Range("E2").Validation
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=$A$30:$A$50"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
However, this generates an error message (when you run it from a commandbutton). If you run it using the debug window, everything is just fine!
One possible solution is that I just use a 'Button' from the forms menu, and attach the macro to it. I would prefer not too, as this substantially reduces the capabilities of the program.
Does anyone have any solutions to this problem, or even reasons for it's occurance?
Thank you,
Nick