Thread: Set worksheet.
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Set worksheet.

If "Columns" was mis-spelled you would get a subscript out of range error.
Is the code in a module and not worksheet code?
--
Gary''s Student


"Kevin Burton" wrote:

I have tried everything and the following statement always gives me an error:

Dim wks As Worksheet

Set wks = Sheets("Columns")

I have an .xls file that has some tabs in it for each "sheet". It turns out
that Sheet3 is named by the tab "Columns". I was expecting to be able to
access this sheet starting with the above statement. But the statement always
throws an error


Runtime error '1004':
Method 'Sheets' of object '_Global' failed

Why is it failing? How do I find out? Is this the correct syntax?

Thank you.

Kevin