Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 98
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 120
Default How do I activate the first worksheet?

Worksheets(1).Activate

hth

keith


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 98
Default 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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 273
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Add-ins and Worksheet activate HSalim[MVP] Excel Programming 3 June 6th 07 03:50 PM
Change Worksheet Button Caption on Worksheet.Activate MikeZz Excel Programming 1 December 7th 06 06:01 AM
Activate a Worksheet Sean[_16_] Excel Programming 6 October 27th 06 06:32 PM
Activate Previous worksheet after adding a new worksheet [email protected] Excel Programming 3 October 19th 05 01:01 AM
Activate Worksheet cottage6 Excel Programming 1 April 21st 05 06:46 PM


All times are GMT +1. The time now is 07:12 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"