ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how do you select the "last" sheet (created) in a workbook (https://www.excelbanter.com/excel-programming/278300-how-do-you-select-last-sheet-created-workbook.html)

Mark Kubicki

how do you select the "last" sheet (created) in a workbook
 
vs, the worksheet attached to the last visible tab displayed in the view?

thanks in advance
mark



Dave Peterson[_3_]

how do you select the "last" sheet (created) in a workbook
 
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

Mark Kubicki wrote:

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

thanks in advance
mark


--

Dave Peterson



All times are GMT +1. The time now is 03:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com