View Full Version : Solved: Adding Worksheets: left or right?
jungix
07-27-2006, 12:56 PM
When I add a worksheet in a workbook thanks to a macro (Worksheet.Add), it is always created on the left of my existing worksheets. I would need it to be added on the right? Is this possible?
lucas
07-27-2006, 01:05 PM
Here is an example of how to copy a worksheet to the end....change copy to add.... basically use before and after
Sub CopySheet()
Dim TotalSheets As Variant
TotalSheets = Worksheets.Count
Sheets("Invoice").Select
Sheets("Invoice").Copy After:=Worksheets(TotalSheets)
ActiveSheet.Name = Range("G3").Value
End Sub
compariniaa
07-27-2006, 02:18 PM
worksheets.add
activesheet.move after:=activesheet 'or _ sheets(worksheets.count)
jungix
07-28-2006, 06:53 AM
It worked with the second one:
ActiveSheet.Move after:=Sheets(Worksheets.Count)
But not with the first one. Thanks anyway.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.