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

Hi:

I have a macro that sorts worksheets regardless of how many sheets. I
need to have the first sheet selected after the sorting is done.

So, if before the sort I have sheets

5 3 8 2 4

After the sort I have

2 3 4 5 8

but the last sheet (8) is selected automatically. I need to have the
first sheet (in this case 2) selected instead. The first sheet will
have different names.

thanks!


---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 618
Default Select First Worksheet

Hi

you can refer to it by its index number ... AFAIK excel always counts the
sheets from the left, so the first sheet can be refered to as

Sheets(1).activate

Regards
JulieD

"halem2 " wrote in message
...
Hi:

I have a macro that sorts worksheets regardless of how many sheets. I
need to have the first sheet selected after the sorting is done.

So, if before the sort I have sheets

5 3 8 2 4

After the sort I have

2 3 4 5 8

but the last sheet (8) is selected automatically. I need to have the
first sheet (in this case 2) selected instead. The first sheet will
have different names.

thanks!


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 157
Default Select First Worksheet

Hi Julie,

"excel always counts the sheets from the left, so the first sheet" is
something new to me.
To understand and verify the same in a workbook with 3 sheets A, B and C (in
that order from left to right) I interchanged positions of A and C and
checked VB editor (in the project window) on how these sheets are referred
as. It said Sheet1(A), Sheet2(B) and Sheet3(C). Why didnt it get updated to
Sheet1(C), Sheet2(B) and Sheet3(A).

Then I saved the sheet and checked again but it showed Sheet1(A), Sheet2(B)
and Sheet3(C). Then I closed and reopened the workbook and now the VB editor
showed it as Sheet1(C), Sheet2(B) and Sheet3(A).

Why the lag in time in updation of the project window?

Surprisingly if I have the following then whenever I interchange the sheets
the present left most only gets highlighted!!

Sub try()
Sheets(2).Activate
End Sub


Regards,
Hari
India

"JulieD" wrote in message
...
Hi

you can refer to it by its index number ... AFAIK excel always counts the
sheets from the left, so the first sheet can be refered to as

Sheets(1).activate

Regards
JulieD

"halem2 " wrote in message
...
Hi:

I have a macro that sorts worksheets regardless of how many sheets. I
need to have the first sheet selected after the sorting is done.

So, if before the sort I have sheets

5 3 8 2 4

After the sort I have

2 3 4 5 8

but the last sheet (8) is selected automatically. I need to have the
first sheet (in this case 2) selected instead. The first sheet will
have different names.

thanks!


---
Message posted from http://www.ExcelForum.com/





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 157
Default Select First Worksheet

Hi,

A typo in sheet number of sub

Sheets(1).Activate

Regards,
Hari
India

"Hari" wrote in message
...
Hi Julie,

"excel always counts the sheets from the left, so the first sheet" is
something new to me.
To understand and verify the same in a workbook with 3 sheets A, B and C

(in
that order from left to right) I interchanged positions of A and C and
checked VB editor (in the project window) on how these sheets are referred
as. It said Sheet1(A), Sheet2(B) and Sheet3(C). Why didnt it get updated

to
Sheet1(C), Sheet2(B) and Sheet3(A).

Then I saved the sheet and checked again but it showed Sheet1(A),

Sheet2(B)
and Sheet3(C). Then I closed and reopened the workbook and now the VB

editor
showed it as Sheet1(C), Sheet2(B) and Sheet3(A).

Why the lag in time in updation of the project window?

Surprisingly if I have the following then whenever I interchange the

sheets
the present left most only gets highlighted!!

Sub try()
Sheets(2).Activate
End Sub


Regards,
Hari
India

"JulieD" wrote in message
...
Hi

you can refer to it by its index number ... AFAIK excel always counts

the
sheets from the left, so the first sheet can be refered to as

Sheets(1).activate

Regards
JulieD

"halem2 " wrote in message
...
Hi:

I have a macro that sorts worksheets regardless of how many sheets. I
need to have the first sheet selected after the sorting is done.

So, if before the sort I have sheets

5 3 8 2 4

After the sort I have

2 3 4 5 8

but the last sheet (8) is selected automatically. I need to have the
first sheet (in this case 2) selected instead. The first sheet will
have different names.

thanks!


---
Message posted from http://www.ExcelForum.com/







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Select First Worksheet

Hi Julie:

thaks for the help. It works for what I'm doing.

thank

--
Message posted from http://www.ExcelForum.com

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 a worksheet Phil Excel Worksheet Functions 1 June 6th 10 03:24 AM
Can I create a worksheet menu to select each other worksheet pippagrace Excel Discussion (Misc queries) 4 June 23rd 06 01:28 PM
In Excel 2000, How do you select the whole of a worksheet (Select. Rascal Excel Discussion (Misc queries) 1 March 5th 05 12:03 AM
In Excel 2000, How do you select the whole of a worksheet (Select. Rascal Excel Discussion (Misc queries) 1 March 4th 05 11:59 PM
Select Data in Worksheet 1 Jim M[_4_] Excel Programming 1 May 13th 04 04:33 PM


All times are GMT +1. The time now is 02:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"