![]() |
Accessing/Clearing range in hidden workbook
Hello all,
I'm trying to clear the contents and formatting in a hidden workbook called PSheet, I'm using the command ThisWorkbook.Sheets("PSheet").Cells.Clear The only problem is that the command will only work when the Sheet is unhidden AND active (i.e. the worksheet in the foreground). If the sheet The error message given is: Error 1004 Clear method of range class failed I have used other commands that use the ThisWorkbook.Sheets format and they all work OK. Any ideas would be appreciated. Thanks DarrenW |
Re : Accessing/Clearing range in hidden workbook
Hello,
Try first toset visible to true and after clearing the cells visible property to false ThisWorkbook.Sheets("PSheet").Visible = True ThisWorkbook.Sheets("PSheet").Cells.Clear ThisWorkbook.Sheets("PSheet").Visible = false Abdul Salam -----Original Message----- Hello all, I'm trying to clear the contents and formatting in a hidden workbook called PSheet, I'm using the command ThisWorkbook.Sheets("PSheet").Cells.Clear The only problem is that the command will only work when the Sheet is unhidden AND active (i.e. the worksheet in the foreground). If the sheet The error message given is: Error 1004 Clear method of range class failed I have used other commands that use the ThisWorkbook.Sheets format and they all work OK. Any ideas would be appreciated. Thanks DarrenW . |
All times are GMT +1. The time now is 11:10 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com