Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheet number??
What code do I execute to find the Worksheet number associated with the
currently selected worksheet? I have a macro that creates a new worksheet before sheet1 by copying a template sheet using: Sheets(ProjectSummaryTemplateSheetName).Copy Befo=Sheets(1) I'd like to place it right before the selected worksheet. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheet number??
One way:
Befo=ActiveSheet.Index In article , John wrote: What code do I execute to find the Worksheet number associated with the currently selected worksheet? I have a macro that creates a new worksheet before sheet1 by copying a template sheet using: Sheets(ProjectSummaryTemplateSheetName).Copy Befo=Sheets(1) I'd like to place it right before the selected worksheet. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheet number??
Try it this way...
Sheets(ProjectSummaryTemplateSheetName).Copy Befo=ActiveSheet -- Rick (MVP - Excel) "John" wrote in message ... What code do I execute to find the Worksheet number associated with the currently selected worksheet? I have a macro that creates a new worksheet before sheet1 by copying a template sheet using: Sheets(ProjectSummaryTemplateSheetName).Copy Befo=Sheets(1) I'd like to place it right before the selected worksheet. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheet number??
On Mon, 2 Feb 2009 13:23:02 -0800, John
wrote: What code do I execute to find the Worksheet number associated with the currently selected worksheet? I have a macro that creates a new worksheet before sheet1 by copying a template sheet using: Sheets(ProjectSummaryTemplateSheetName).Copy Befo=Sheets(1) I'd like to place it right before the selected worksheet. Try this code: For i = 1 To Worksheets.Count If Worksheets(i).Name = ActiveSheet.Name Then n = i Next i Sheets(ProjectSummaryTemplateSheetName).Copy Befo=Sheets(n) Hope this helps / Lars-Åke |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Sum of different value in different worksheet & cell number | Excel Worksheet Functions | |||
TOC: the first page number of each worksheet | Excel Discussion (Misc queries) | |||
Finding the number of a worksheet | Excel Discussion (Misc queries) | |||
Enter number on a worksheet to copy row from another worksheet | Excel Worksheet Functions | |||
Basic Question - How do I return the worksheet number of the active worksheet? | Excel Programming |