Use VBA to reset data validation (=list) value to first value in that list (list is a named range)
Susan-
Thank you for your response. I set S to the validation formula (which is a
named range list), and my goal is to reset the contents of that data
validation cell to the first value in the available list (hence the final
(1)). When I remove it, I get a 1004 runtime error method 'range' of object
'_worksheet' failed, which is the same error message I get with the (1) in
place.
I welcome any other thoughts
:)
Thanks,
Keith
"Susan" wrote in message
...
try taking out the (1)
Sheet12.Range("E2").Value = Range(S)
as far as i can see you don't declare it as a variable anywhere, it
just seems like it just popped in & is doing nothing.
hope that helps
:)
susan
On Oct 20, 12:39 pm, "ker_01" wrote:
I have a cell that has data validation (=list), populated by a named range
In my VBA, I need to be able to reset that list to the first value in the
list. I had the code working, but I must have tweaked something without
knowing it, and now it doesn't work anymore.
If Target.Address = "$B$2" Then
'just reset the date back to earliest date in the list
S = Sheet12.Range("E2").Validation.Formula1
Sheet12.Activate
Sheet12.Range("E2").Value = Range(S)(1) '<- this is the line that
doesn't work
Set Target = Sheet12.Range("E2")
End If
Thanks for any advice,
Keith
|