Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default Sheets.Select

What might prevent Sheets.Select from working? I've run across the same
problem in Excel 200 and Excel 2003 in different workbooks. In each case,
the line Sheets.Select has no response (doesn't select any of the sheets in
the workbooks). There's no error so the macro continues to run.

I've also gome back and recorded an array that lists each of the sheets and
replaced the "Sheets.Select", but it does the same thing.

The odd thing is that each of these commands do work in other workbooks, so
I'm perplexed on why it works on some but not others. Anyone aware of
anything I can check?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Sheets.Select

Sheets.Select is selecting the 1st worksheet in the workbook. It is better
to call out the name of the worksheet if you need to select some other
worksheet like
sheets("Sheet2").

"StephanieH" wrote:

What might prevent Sheets.Select from working? I've run across the same
problem in Excel 200 and Excel 2003 in different workbooks. In each case,
the line Sheets.Select has no response (doesn't select any of the sheets in
the workbooks). There's no error so the macro continues to run.

I've also gome back and recorded an array that lists each of the sheets and
replaced the "Sheets.Select", but it does the same thing.

The odd thing is that each of these commands do work in other workbooks, so
I'm perplexed on why it works on some but not others. Anyone aware of
anything I can check?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Sheets.Select

Are you sure you're looking at the correct workbook?

Sheets.select

should select all the sheets of the activeworkbook.

StephanieH wrote:

What might prevent Sheets.Select from working? I've run across the same
problem in Excel 200 and Excel 2003 in different workbooks. In each case,
the line Sheets.Select has no response (doesn't select any of the sheets in
the workbooks). There's no error so the macro continues to run.

I've also gome back and recorded an array that lists each of the sheets and
replaced the "Sheets.Select", but it does the same thing.

The odd thing is that each of these commands do work in other workbooks, so
I'm perplexed on why it works on some but not others. Anyone aware of
anything I can check?


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default Sheets.Select

I've tried listing the actual pages (no response)
Windows("Loan Recovery 12mo Liq by CO Compiled n.xls").Activate
Sheets(Array("Charts", "Rollup", "ARP", "Auto Finance", "RSB",
"Commercial", _
"Credit Card", "DDA", "Direct", "FUHEB", "HEL", "Lease", "FUMC",
"TMS - PEL", "PEL", _
"Revolving", "TMS", "DFS", "W & T")).Select

and selecting all sheets regardless of name

Windows("Loan Recovery 12mo Liq by CO Compiled n.xls").Activate
Sheets.Select

Neither is working.

To force it to work, I've inserted a break and I'm manualy selecting all
sheets each time it stops (it's in the middle of loop).

The only other thing I can think of that might affect it is that I'm
toggling between two workbooks. The second workbook contains worksheets with
the same title except "Charts".

Could that trip it up even though the second workbook would not be active at
the time?





"Dave Peterson" wrote:

Are you sure you're looking at the correct workbook?

Sheets.select

should select all the sheets of the activeworkbook.

StephanieH wrote:

What might prevent Sheets.Select from working? I've run across the same
problem in Excel 200 and Excel 2003 in different workbooks. In each case,
the line Sheets.Select has no response (doesn't select any of the sheets in
the workbooks). There's no error so the macro continues to run.

I've also gome back and recorded an array that lists each of the sheets and
replaced the "Sheets.Select", but it does the same thing.

The odd thing is that each of these commands do work in other workbooks, so
I'm perplexed on why it works on some but not others. Anyone aware of
anything I can check?


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default Sheets.Select

I figured it out thanks to the help from both of you (Joel & Dave). When I
originally developed the macro, I didn't have the worksheet "Charts". I'd
added a line to hide that sheet so that the changes I made to the rest of the
sheets didn't affect that worksheet. I didn't realize that with that sheet
hidden, "Sheets.Select" wouldn't select the 'visible' sheets.

That also explains why I would run across the same problem in other
workbooks as we've added information to many of our workbooks over the past
year.

Thanks to you both!




"StephanieH" wrote:

What might prevent Sheets.Select from working? I've run across the same
problem in Excel 200 and Excel 2003 in different workbooks. In each case,
the line Sheets.Select has no response (doesn't select any of the sheets in
the workbooks). There's no error so the macro continues to run.

I've also gome back and recorded an array that lists each of the sheets and
replaced the "Sheets.Select", but it does the same thing.

The odd thing is that each of these commands do work in other workbooks, so
I'm perplexed on why it works on some but not others. Anyone aware of
anything I can check?



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Sheets.Select

Maybe qualifying the sheets would be enough:

with workbooks("Loan Recovery 12mo Liq by CO Compiled n.xls")
.activate
.sheets.select
end with



StephanieH wrote:

I've tried listing the actual pages (no response)
Windows("Loan Recovery 12mo Liq by CO Compiled n.xls").Activate
Sheets(Array("Charts", "Rollup", "ARP", "Auto Finance", "RSB",
"Commercial", _
"Credit Card", "DDA", "Direct", "FUHEB", "HEL", "Lease", "FUMC",
"TMS - PEL", "PEL", _
"Revolving", "TMS", "DFS", "W & T")).Select

and selecting all sheets regardless of name

Windows("Loan Recovery 12mo Liq by CO Compiled n.xls").Activate
Sheets.Select

Neither is working.

To force it to work, I've inserted a break and I'm manualy selecting all
sheets each time it stops (it's in the middle of loop).

The only other thing I can think of that might affect it is that I'm
toggling between two workbooks. The second workbook contains worksheets with
the same title except "Charts".

Could that trip it up even though the second workbook would not be active at
the time?

"Dave Peterson" wrote:

Are you sure you're looking at the correct workbook?

Sheets.select

should select all the sheets of the activeworkbook.

StephanieH wrote:

What might prevent Sheets.Select from working? I've run across the same
problem in Excel 200 and Excel 2003 in different workbooks. In each case,
the line Sheets.Select has no response (doesn't select any of the sheets in
the workbooks). There's no error so the macro continues to run.

I've also gome back and recorded an array that lists each of the sheets and
replaced the "Sheets.Select", but it does the same thing.

The odd thing is that each of these commands do work in other workbooks, so
I'm perplexed on why it works on some but not others. Anyone aware of
anything I can check?


--

Dave Peterson


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Sheets.Select

I get an error if I try to select sheets that are hidden.

If you didn't get an error, then maybe you were masking it with
"on error resume next"

It's usually a pretty dangerous programming practice to leave that switch on for
long portions of code--or to hide errors/conditions that should be programmed
around.

StephanieH wrote:

I figured it out thanks to the help from both of you (Joel & Dave). When I
originally developed the macro, I didn't have the worksheet "Charts". I'd
added a line to hide that sheet so that the changes I made to the rest of the
sheets didn't affect that worksheet. I didn't realize that with that sheet
hidden, "Sheets.Select" wouldn't select the 'visible' sheets.

That also explains why I would run across the same problem in other
workbooks as we've added information to many of our workbooks over the past
year.

Thanks to you both!

"StephanieH" wrote:

What might prevent Sheets.Select from working? I've run across the same
problem in Excel 200 and Excel 2003 in different workbooks. In each case,
the line Sheets.Select has no response (doesn't select any of the sheets in
the workbooks). There's no error so the macro continues to run.

I've also gome back and recorded an array that lists each of the sheets and
replaced the "Sheets.Select", but it does the same thing.

The odd thing is that each of these commands do work in other workbooks, so
I'm perplexed on why it works on some but not others. Anyone aware of
anything I can check?


--

Dave Peterson
Reply
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
Select the same cell in sheets 2 & sheets 3 Oggy Excel Programming 0 January 8th 07 08:02 PM
How to Select All sheets Dawn Bjork Buzbee Excel Programming 2 April 26th 06 12:20 AM
Select first 3 sheets StephanieH Excel Programming 5 December 30th 05 04:59 PM
sheets.select kurt Excel Programming 2 November 28th 05 04:34 PM
select sheets by name - how? Walt[_2_] Excel Programming 5 July 30th 03 10:42 PM


All times are GMT +1. The time now is 09:00 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"