ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ActiveWorkbook.Sheets.Select (https://www.excelbanter.com/excel-programming/396099-activeworkbook-sheets-select.html)

StephanieH

ActiveWorkbook.Sheets.Select
 
I'm trying to select all sheets in my workbook. In the past, I've always
used ActiveWorkbook.Sheets.Select. For some reason, this time I'm getting
"Run-time error '1004'". I've never seen this in the past.

Any other ways to select all sheets? Anyone have an idea why it would work
in other workbooks, but not this one?

SysAccountant

ActiveWorkbook.Sheets.Select
 
It would appear to be an anomaly

If it 's preventing you from continuing ,just simply code it into an error
handler.

For Example :
On Error goto err_Handler


....code etc


err_Handler:

If err. number = 1004 then

Exit Sub

End if



HTH


Regards

SysAccountant


"StephanieH" wrote:

I'm trying to select all sheets in my workbook. In the past, I've always
used ActiveWorkbook.Sheets.Select. For some reason, this time I'm getting
"Run-time error '1004'". I've never seen this in the past.

Any other ways to select all sheets? Anyone have an idea why it would work
in other workbooks, but not this one?


StephanieH

ActiveWorkbook.Sheets.Select
 
That somewhat worked. It would allow me to skip the step, but obviously it
messes up everything that takes place after that since it was a necessary
step. I ended up just rerecording the piece to select each sheet through an
array.


"SysAccountant" wrote:

It would appear to be an anomaly

If it 's preventing you from continuing ,just simply code it into an error
handler.

For Example :
On Error goto err_Handler


...code etc


err_Handler:

If err. number = 1004 then

Exit Sub

End if



HTH


Regards

SysAccountant


"StephanieH" wrote:

I'm trying to select all sheets in my workbook. In the past, I've always
used ActiveWorkbook.Sheets.Select. For some reason, this time I'm getting
"Run-time error '1004'". I've never seen this in the past.

Any other ways to select all sheets? Anyone have an idea why it would work
in other workbooks, but not this one?



All times are GMT +1. The time now is 06:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com