how do you select the "last" sheet (created) in a workbook

M

Mark Kubicki

vs, the worksheet attached to the last visible tab displayed in the view?

thanks in advance
mark
 
D

Dave Peterson

One way:

Option Explicit
Sub testme04()

Dim iCtr As Long

For iCtr = Worksheets.Count To 1 Step -1
If Worksheets(iCtr).Visible = xlSheetVisible Then
Worksheets(iCtr).Select
Exit For
End If
Next iCtr
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top