View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Vasant Nanavati Vasant Nanavati is offline
external usenet poster
 
Posts: 1,080
Default Confused with variable

1. "WorksheetNames" is mispelled.

2. The correct syntax is Worksheets(Name)

3. Also, since Name is a reserved VBA word, it may be better to use another
name (no pun intended) for your cell variable.

--

Vasant


"Ray Batig" wrote in message
ink.net...
Greetings,

I have a named range called WorksheetNames. I want to cycle through them

and
do a set of operations. I wrote the following simplified code, however, I
can't seem to get the Name to work in the Worksheets() convention.

Dim Name As Range

For Each Name in Range("WorsheetNames")
Worksheet(Name).Cells(1,1).Value = "No Flag Set"
Other code
Next Name

Would someone explain what I am missing?

Thanks,
Ray