MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Selecting a cell range in hidden worksheet


Posted by Jamie on March 31, 2000 8:29 AM

Hello,
I need to clear a cell range in a hidden worksheet and I'm not sure how to do it. The following formula works while the sheet is unhidden but, after I hide the sheet, I get an error.
Sheets("sheet2").Select
Range("A1:A7").Select
Selection.ClearContents
Can anyone help??
Thanks,
Jamie


Posted by AB on March 31, 2000 9:05 AM

You can't select a cell range in a hidden sheet.

However, for your situation you don't want to select it, you just want to clear the contents.

Sheets("sheet2").Range("A1:A7").ClearContents

Try to avoid selecting stuff so your macros will run faster and more efficiently.

Posted by Jamie on March 31, 2000 9:37 AM

Great, thanks

AB,
thanks for the info. It is much appreciated.
Jamie