ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   selecting worksheet by its index. (https://www.excelbanter.com/excel-programming/401046-selecting-worksheet-its-index.html)

[email protected]

selecting worksheet by its index.
 
Initially I have Sheet1(Sheet3). Later I rename the Sheet 3. Let's
assume it becomes Sheet1(AAA). The name changes periodically. So, I
would like to select it using the sheet's index. What would be the
macro/syntax for this? Thanks


Nigel[_2_]

selecting worksheet by its index.
 
Sheets(1).Activate

However this relates to the first sheet in the workbook, change it's
position and index number changes. Consider using the codename which can be
set in the VBA Editor.

--

Regards,
Nigel




wrote in message
ups.com...
Initially I have Sheet1(Sheet3). Later I rename the Sheet 3. Let's
assume it becomes Sheet1(AAA). The name changes periodically. So, I
would like to select it using the sheet's index. What would be the
macro/syntax for this? Thanks



[email protected]

selecting worksheet by its index.
 
On Nov 13, 10:54 am, "Nigel" wrote:
Sheets(1).Activate

However this relates to the first sheet in the workbook, change it's
position and index number changes. Consider using the codename which can be
set in the VBA Editor.

--

Regards,
Nigel


wrote in message

ups.com...



Initially I have Sheet1(Sheet3). Later I rename the Sheet 3. Let's
assume it becomes Sheet1(AAA). The name changes periodically. So, I
would like to select it using the sheet's index. What would be the
macro/syntax for this? Thanks- Hide quoted text -


- Show quoted text -


Hi.. could you please let me know how to tackle this problem using
something in the lines of

dim wsindex as integer
if wsindex = 1 then
'activate that sheet
end if

Thanks


JP[_3_]

selecting worksheet by its index.
 
You can just delete the sheet directly by using "Sheets(1).Delete" or
"Sheet1.Delete"



HTH,
JP

On Nov 13, 2:46 pm, wrote:


Hi.. could you please let me know how to tackle this problem using
something in the lines of

dim wsindex as integer
if wsindex = 1 then
'activate that sheet
end if

Thanks




All times are GMT +1. The time now is 10:31 PM.

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