S
Simon Plenderleith
I get the error "Run-time error '1004': Application-defined or
object-defined error" on the following piece of code:
Dim x As Integer
For x = 10 To 29
With Sheets("Invoice").Range("$C$" & x)
.Validation.Delete
.Validation.Add xlValidateList, , "=$M$1:$M$" & Cnt_Stock
End With
Next x
(The variable Cnt_Stock is already predefined with an integer such as 25)
The .Validation.Add line is pointed to when debugging the error. I can't
see what is causing this. I have the worksheet protected using VBA, like
so:
Sheets("Invoice").Protect Password:="sms", UserInterfaceOnly:=True
And this seems to work fine on other worksheets so that the VBA can
manipulate the worksheet without having to change the protection, and the
user interface protection remains.
Any help is really appreciated!
Thanks,
Simon Plenderleith
object-defined error" on the following piece of code:
Dim x As Integer
For x = 10 To 29
With Sheets("Invoice").Range("$C$" & x)
.Validation.Delete
.Validation.Add xlValidateList, , "=$M$1:$M$" & Cnt_Stock
End With
Next x
(The variable Cnt_Stock is already predefined with an integer such as 25)
The .Validation.Add line is pointed to when debugging the error. I can't
see what is causing this. I have the worksheet protected using VBA, like
so:
Sheets("Invoice").Protect Password:="sms", UserInterfaceOnly:=True
And this seems to work fine on other worksheets so that the VBA can
manipulate the worksheet without having to change the protection, and the
user interface protection remains.
Any help is really appreciated!
Thanks,
Simon Plenderleith