Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Select a worksheet | Excel Worksheet Functions | |||
Can I create a worksheet menu to select each other worksheet | Excel Discussion (Misc queries) | |||
In Excel 2000, How do you select the whole of a worksheet (Select. | Excel Discussion (Misc queries) | |||
In Excel 2000, How do you select the whole of a worksheet (Select. | Excel Discussion (Misc queries) | |||
Select Data in Worksheet 1 | Excel Programming |