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
 

Nimrod

MrExcel MVP
Joined
Apr 29, 2002
Messages
6,259
Code:
Public Sub Demo()
Dim NewSh As Worksheet

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

End Sub
 

Tom Urtis

MrExcel MVP
Joined
Feb 10, 2002
Messages
11,197
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)
 

dantb

Active Member
Joined
Mar 20, 2002
Messages
358
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
 

Forum statistics

Threads
1,078,373
Messages
5,339,814
Members
399,328
Latest member
Jasonabelly

Some videos you may like

This Week's Hot Topics

Top