Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default VBA - identifying which worksheet is active

Must be the weather or something but ...
I am having problems working out how to retrieve the sequential number of an
active worksheet (Activeworksheet does not supptort the various properties I
have tried...). Yeah, I know, should be trivial but I am obviosuly not
thinking of the right key words to find any help either. Suggestions much
appreciated. All I want to do really is count how many more worksheets IO
have after the active one.
Many thanks and best wishes.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default VBA - identifying which worksheet is active

Sub which()
Dim n As String
n = ActiveSheet.Name
i = 1
For Each w In Worksheets
If w.Name = n Then
MsgBox (i)
End If
i = i + 1
Next
End Sub
--
Gary''s Student - gsnu200753
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default VBA - identifying which worksheet is active

Many thanks for the suggestion. This would definately work but is more
complicated than I had hoped for. I was hoping Index would work but I get an
error message when I try that - might of course be my typing.
Anyway, thanks for the suggestion.
Best wishes, Boris.

"Gary''s Student" wrote:

Sub which()
Dim n As String
n = ActiveSheet.Name
i = 1
For Each w In Worksheets
If w.Name = n Then
MsgBox (i)
End If
i = i + 1
Next
End Sub
--
Gary''s Student - gsnu200753

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
VBA - identifying which worksheet is active Boris Excel Programming 2 November 5th 07 11:56 AM
Identifying cursor in active spreedsheet C Ambrose Excel Worksheet Functions 9 May 24th 05 11:36 PM
Identifying the Active Fill Color Steve Conary Excel Discussion (Misc queries) 3 December 9th 04 04:45 AM
Identifying the Active Fill Color Steve Conary Excel Programming 3 December 9th 04 04:45 AM
Identifying the active cell Pienpeas Excel Programming 2 September 15th 04 12:13 PM


All times are GMT +1. The time now is 05:34 PM.

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"