How do I activate the first worksheet?
I want to activate the first worksheet out of x number in a workbook.
The sheet names will vary every time, so I was wondering how you select the first sheet using generic code. Thanks, Mel |
How do I activate the first worksheet?
Worksheets(1).Activate
hth keith |
How do I activate the first worksheet?
Excellent, and so simple! Cheers Keith.
Is there a way of activating the last sheet again? There may be any number of sheets so I guess its not Worksheets(20 or whatever).Activate Thanks, Mel "Keith74" wrote: Worksheets(1).Activate hth keith |
How do I activate the first worksheet?
You might try:
Sub LastSht() Dim CntSheets As Long 'Activate last worksheet in the workbook With Application CntSheets = .Sheets.Count - .Charts.Count .Worksheets(CntSheets).Activate End With End Sub "Meltad" wrote: Excellent, and so simple! Cheers Keith. Is there a way of activating the last sheet again? There may be any number of sheets so I guess its not Worksheets(20 or whatever).Activate Thanks, Mel "Keith74" wrote: Worksheets(1).Activate hth keith |
All times are GMT +1. The time now is 06:38 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com