View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
JLatham JLatham is offline
external usenet poster
 
Posts: 2,203
Default VBA code to affect value of a named range

You may need to put some testing code in there to see what you should
actually be looking for.
Try putting code similar to this in that event code to examine the various
values/conditions of the Named Range

MsgBox "RefersToR1C1 is: " & ActiveWorkbook.Names("DatesUpdated").RefersToR1C1
MsgBox "Value is: " & ActiveWorkbook.Names("DatesUpdated").Value
MsgBox "RefersTo: " & ActiveWorkbook.Names("DatesUpdated").RefersTo

I believe you're going to see that what's returned is "=True" or "=False"
and that's what you need to test against, and how you need to set/reset the
value (using the .RefersTo or .RefersToR1C1 property), like
ActiveWorkbook.Names("DatesUpdated").RefersToR1C1 = "=False"
or
ActiveWorkbook.Names("DatesUpdated").RefersToR1C1 = "=True"


"Dave" wrote:

Hi, JL-
Thanks for your response: here are answers to your questions:
~Do you know if the _Change event is occuring?
Yes, the change event is triggering- the code generates an error
message each time. The intent of my post was to determine if I was
using incorrect syntax, and what is the correct syntax in this context.

~they're going to see that prompt quite a bit as long as the value
remains False
That's the idea: to remind the user they need to validate/accept
certain data before making changes and before moving on in the process.

~they'll never see the question again - the .value will change to true
and remain that way
A good catch, and an important one. What I did not mention in the post
is that there is an "on close" event that changes the value to false;
that value is saved with the file and "reset" for the next user.