Worksheets() Object
worksheets(Temp)
if Temp is a variable that holds a string.
But maybe you should test to see if that string actually contains a worksheet
name:
dim wks as worksheet
dim Temp as string
temp = "somestring"
set wks = nothing
on error resume next
set wks = worksheets(Temp)
on error goto 0
if wks is nothing then
'no worksheet with that name
else
'yes there is
end if
dallin wrote:
I'm trying to pass a text variable to the Worksheets() object where Temp is a
text variable, however, I must not be using the right syntax. I've used
Worksheets("Temp") and Worksheets(Temp) without success. What is the correct
syntax for this?
--
thanks, mc
--
Dave Peterson
|