LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 692
Default setting range().hidden=True causes range error 1004

First - thanks for any help.

Using XL 2000 on Win XP

I am using the following lines of code in 2 places in my workbook to
show and hide columns:

ThisWorkbook.Sheets(WSn).Range(Columns(1), Columns(col2 + 1)).Hidden = False
ThisWorkbook.Sheets(WSn).Range(Columns(2), Columns(col1)).Hidden = True <<<<
error 1004

In another module where I use the actual sheet name - it works fine.

ThisWorkbook.Sheets("Summary").Range(Columns(2), Columns(x)).Hidden = False
'some code
ThisWorkbook.Sheets("Summary").Range(Columns(2), Columns(col1)).Hidden =
True

But in this module where I am using a string variable for the sheet name
the second line errors out. (1004) I even copied the working code over and
changed
the sheet name to the variable.

Double checked the variable values and they appear to be reasonable

Can any body try to explain this to me...?

Thanks...
--
steveB

Remove "AYN" from email to respond


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error '1004' - the specified value is out of range. Chris Excel Programming 13 September 20th 06 11:04 AM
Range Question / error 1004: method Range of object Worksheet has failed Paul Excel Programming 3 April 7th 05 02:56 PM
1004 error when selecting a range Matt J[_2_] Excel Programming 9 July 3rd 04 10:05 PM
Error 1004 when selecting a range Matt J Excel Programming 1 July 3rd 04 06:50 PM
Range.Copy and error 1004 Carl Rapson Excel Programming 5 November 15th 03 03:21 AM


All times are GMT +1. The time now is 11:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"