Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default determine what sheet user is viewing

This is probably very simple.

How can I make VBA know what sheet the user is viewing at the time they
activate a macro?

For instance, if they are looking at sheet 17, I want the macro's dialog box
to customize itself to limit its choices to those relevant to sheet 17. I
can do the customization, but don't know the 'if worksheet 17 is active
then...' command.

Thanks.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default determine what sheet user is viewing

If ActiveSheet.Name = "theName" Then
-or-
If ActiveSheet.CodeName = "theName" Then

Will serve your purpose.

The ".Name" property will give the name that is displayed on the SheetTab.
The ".CodeName" property will give the internal name of the sheet (e.g.
Sheet1, Sheet2, etc.), which can't be changed by the user. If the user
happens to rename the sheet, your macro will probably break if you use
".Name".

Troy

"Elias" wrote in message
...
This is probably very simple.

How can I make VBA know what sheet the user is viewing at the time they
activate a macro?

For instance, if they are looking at sheet 17, I want the macro's dialog

box
to customize itself to limit its choices to those relevant to sheet 17. I
can do the customization, but don't know the 'if worksheet 17 is active
then...' command.

Thanks.




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
logging user name after viewing protected workbook Melanie New Users to Excel 8 August 17th 09 11:34 PM
Password protect sheet from viewing Enrique Excel Worksheet Functions 4 April 14th 09 04:52 PM
Viewing file user history unidie Excel Discussion (Misc queries) 1 October 2nd 08 05:01 PM
MS EXCEL SHEET CRASHES WHEN VIEWING Wally Excel Discussion (Misc queries) 1 September 7th 05 03:02 PM
How do I deny opening and viewing any file to any user and lock i. Leah Wright Excel Discussion (Misc queries) 1 April 22nd 05 11:59 PM


All times are GMT +1. The time now is 11:42 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"