go to last sheet added

dantb

Active Member
Joined
Mar 20, 2002
Messages
358
Hello all: any way for excel to go to the last sheet added without knowing its name? Have tryed the below, but no luck. Trying to add a sheet and have excel open/go too it. thanks Dan

Worksheets.Add
Worksheets(Worksheets.Count).Activate
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Code:
Public Sub Demo()
Dim NewSh As Worksheet

    Set NewSh = Worksheets.Add
    
    NewSh.Activate
    
    MsgBox "The Sheet " & NewSh.Name & " has been activated"

End Sub
 
Upvote 0
Once you add a new sheet, it already is the active sheet at that moment.

Sheets.add
would suffice.

To have it be added (and activated) as the last sheet
Worksheets.Add After:=Sheets(Sheets.Count)
 
Upvote 0
Thanks Nimrod, works well. Been having a problem with

Selection.PasteSpecial Paste:=xlPasteColumnWidths, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False

In Excel 2003 SP1 and trying to find a work around. Seem when I Just use the Add sheet in this version, the above line does not work, but other versions do. Thanks again for your help. Dan
 
Upvote 0

Forum statistics

Threads
1,214,667
Messages
6,120,815
Members
448,990
Latest member
rohitsomani

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top