Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How do I reference the last worksheet in a workbook so
that the most recently added sheet is affected by my macro. I've tried worksheets(sheet.count + 1) but that doesn't seem to work. Also how can I get my inserted sheet to always be on the far right. They seem to pop in randomly at the moment. Cheers guys |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I've tried worksheets(sheet.count + 1)
You are close Sheets(Sheets.Count).Select Change Sheets to Worksheets if you have also Chart sheets in the workbook -- Regards Ron de Bruin (Win XP Pro SP-1 XL2000-2003) www.rondebruin.nl "libby" wrote in message ... How do I reference the last worksheet in a workbook so that the most recently added sheet is affected by my macro. I've tried worksheets(sheet.count + 1) but that doesn't seem to work. Also how can I get my inserted sheet to always be on the far right. They seem to pop in randomly at the moment. Cheers guys |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This code goes in the Workbook module.
Private Sub Workbook_NewSheet(ByVal Sh As Object) Sh.Move After:=Worksheets (ThisWorkbook.Worksheets.Count) End Sub Is this what you were looking for? -Brad -----Original Message----- How do I reference the last worksheet in a workbook so that the most recently added sheet is affected by my macro. I've tried worksheets(sheet.count + 1) but that doesn't seem to work. Also how can I get my inserted sheet to always be on the far right. They seem to pop in randomly at the moment. Cheers guys . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Referencing data across sheets | Excel Worksheet Functions | |||
Referencing sheets | Excel Discussion (Misc queries) | |||
When referencing other Sheets | Excel Discussion (Misc queries) | |||
Referencing Different Sheets in VBA | Excel Discussion (Misc queries) | |||
Referencing Sheets | Excel Programming |