![]() |
Moving worksheets using VBA
I am trying to add a function in a Macro that will copy the first worksheet in a workbook to AFTER the last worksheet in the same book using Excel 2000. The syntax I am using is Sheets(1).Select Sheets(1).Copy After:=Sheets(2) which works fine if I only have 2 worksheets but not if I have 9, or if the number of worksheets change each time the worksheet opens (which is the purpose of the macro) Can any one help please?? |
Moving worksheets using VBA
Sheets(1).Copy After:=Sheets(Sheets.Count) "RobJ" wrote: I am trying to add a function in a Macro that will copy the first worksheet in a workbook to AFTER the last worksheet in the same book using Excel 2000. The syntax I am using is Sheets(1).Select Sheets(1).Copy After:=Sheets(2) which works fine if I only have 2 worksheets but not if I have 9, or if the number of worksheets change each time the worksheet opens (which is the purpose of the macro) Can any one help please?? |
Moving worksheets using VBA
Thanks very much for your help. It works fantastically "JLGWhiz" wrote: Sheets(1).Copy After:=Sheets(Sheets.Count) "RobJ" wrote: I am trying to add a function in a Macro that will copy the first worksheet in a workbook to AFTER the last worksheet in the same book using Excel 2000. The syntax I am using is Sheets(1).Select Sheets(1).Copy After:=Sheets(2) which works fine if I only have 2 worksheets but not if I have 9, or if the number of worksheets change each time the worksheet opens (which is the purpose of the macro) Can any one help please?? |
All times are GMT +1. The time now is 01:59 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com