Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have the following code written in a macro:
Application.Goto Reference:="'Worksheet A'!RC" Sheets("Worksheet A").Copy After:=Sheets(5) What I really want to do is copy 'Worksheet A' after the last worksheet in my workbook regardless of how many worksheets there are in the workbook, and NOT always after Sheet 5. Thanks for your help. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try following code:
Application.Goto Reference:="'Worksheet A'!RC" Sheets("Worksheet A").Copy After:=Sheets(ActiveWorkbook.Sheets.Count) Regards reklamo "DBavirsha" wrote: I have the following code written in a macro: Application.Goto Reference:="'Worksheet A'!RC" Sheets("Worksheet A").Copy After:=Sheets(5) What I really want to do is copy 'Worksheet A' after the last worksheet in my workbook regardless of how many worksheets there are in the workbook, and NOT always after Sheet 5. Thanks for your help. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Worked like a charm. Thanks for your quick help!!
Dave "reklamo" wrote: Try following code: Application.Goto Reference:="'Worksheet A'!RC" Sheets("Worksheet A").Copy After:=Sheets(ActiveWorkbook.Sheets.Count) Regards reklamo "DBavirsha" wrote: I have the following code written in a macro: Application.Goto Reference:="'Worksheet A'!RC" Sheets("Worksheet A").Copy After:=Sheets(5) What I really want to do is copy 'Worksheet A' after the last worksheet in my workbook regardless of how many worksheets there are in the workbook, and NOT always after Sheet 5. Thanks for your help. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try this:
Dim MySheetIndex MySheetIndex = 1 For Each Sheet In Worksheets If Sheet.Index MySheetIndex Then MySheetIndex = Sheet.Index End If Next Sheet Application.Goto Reference:="'Worksheet A'!RC" Sheets("Worksheet A").Copy After:=Sheets(MySheetIndex) Hope this helps, Keith "DBavirsha" wrote: I have the following code written in a macro: Application.Goto Reference:="'Worksheet A'!RC" Sheets("Worksheet A").Copy After:=Sheets(5) What I really want to do is copy 'Worksheet A' after the last worksheet in my workbook regardless of how many worksheets there are in the workbook, and NOT always after Sheet 5. Thanks for your help. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copy and Paste Chart as Picture into another workbook or worksheet | Charts and Charting in Excel | |||
I cannot paste from one workbook to another. Copy works, paste do. | Excel Discussion (Misc queries) | |||
copy data from one worksheet and paste into another workbook | Excel Programming | |||
Copy worksheet and paste it in New workbook, all data except Formulas | Excel Programming | |||
Copy and paste the worksheet to New workbook.. | Excel Programming |