ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Refusal of Excel to recognization Worksheet name (https://www.excelbanter.com/excel-programming/290922-refusal-excel-recognization-worksheet-name.html)

John H[_4_]

Refusal of Excel to recognization Worksheet name
 
I have one Workbook that has a unique problem. When I attempt to access it from code in a module with the name of the sheet or "Sheet1", I get a <subscript out of range error. I can access when I use the number (provided it is the first sheet). The code is

With Worksheets("Sheet1") ' gets me <subscript out of range

With Worksheets(1) ' work

This same sheet will not run a function attached to that sheet or from a module

Is there some switch that needs to be changed?

Dick Kusleika[_3_]

Refusal of Excel to recognization Worksheet name
 
John

"John H" wrote in message
...
I have one Workbook that has a unique problem. When I attempt to access

it from code in a module with the name of the sheet or "Sheet1", I get a
<subscript out of range error. I can access when I use the number
(provided it is the first sheet). The code is:

With Worksheets("Sheet1") ' gets me <subscript out of range


You don't have a worksheet named Sheet1. Make sure you're spelling it
correctly. Less likely is that it's not a worksheet, but a chart sheet.


With Worksheets(1) ' works

This same sheet will not run a function attached to that sheet or from a

module.

Is there some switch that needs to be changed?


What is a "function attached to that sheet"?

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.




All times are GMT +1. The time now is 07:20 PM.

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