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.
|