Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Action on sheet Selection


Hello everyone, Im back for another probably easy question. How would
get excel to preform a certain action, or macro, when a specific shee
is selected? Thanks again everyone

--
jpizzl
-----------------------------------------------------------------------
jpizzle's Profile: http://www.excelforum.com/member.php...fo&userid=2392
View this thread: http://www.excelforum.com/showthread.php?threadid=37699

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Action on sheet Selection


thank you sir

--
jpizzl
-----------------------------------------------------------------------
jpizzle's Profile: http://www.excelforum.com/member.php...fo&userid=2392
View this thread: http://www.excelforum.com/showthread.php?threadid=37699

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Action on sheet Selection


jpizzle Wrote:
thank you sir.


jpizzle
Glad to be of help.
Dave


--
Piranha
------------------------------------------------------------------------
Piranha's Profile: http://www.excelforum.com/member.php...o&userid=20435
View this thread: http://www.excelforum.com/showthread...hreadid=376995

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Action on sheet Selection


Dear Sir,

Try this:

Place the code below in "ThisWorkbook" Module of your workbook

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim SheetName As String
SheetName = "Sheet1"

If Sh.Name = SheetName Then
'Your code goes here
MsgBox "You Selected Sheet: " & Sh.Name
End If
End Sub

What you need to do:
Replace SheetName with the name of the sheet you want to capture and
place you code where it says "Your Code Here". Remenber to remove the
msgbox instruction I placed for ilustration.

What it does:
When you select Sheet1 (Name I selected for SheetName) will display a
message with the name of the selected sheet.

How it works:
When you select a sheet the "Workbook_SheetActivate" event fires.
Excel passes the sheet name through the variable "Sh".

SheetName = "Sheet1" -- Here you replace "Sheet1" with the name of
the sheet you want to capture.


If Sh.Name = SheetName Then
'PLACE YOUR CODE HERE
End If

Please, let me know if that solve your ploblem.

regards.

Juan Carlos


--
cscorp
------------------------------------------------------------------------
cscorp's Profile: http://www.excelforum.com/member.php...o&userid=24015
View this thread: http://www.excelforum.com/showthread...hreadid=376995

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 121
Default Action on sheet Selection

Previous post is better, put the code in the specific sheet's module, that
way if the user changes the sheet name, it will not cause the code to fail.
Bill

"cscorp" wrote in
message ...

Dear Sir,

Try this:

Place the code below in "ThisWorkbook" Module of your workbook

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim SheetName As String
SheetName = "Sheet1"

If Sh.Name = SheetName Then
'Your code goes here
MsgBox "You Selected Sheet: " & Sh.Name
End If
End Sub

What you need to do:
Replace SheetName with the name of the sheet you want to capture and
place you code where it says "Your Code Here". Remenber to remove the
msgbox instruction I placed for ilustration.

What it does:
When you select Sheet1 (Name I selected for SheetName) will display a
message with the name of the selected sheet.

How it works:
When you select a sheet the "Workbook_SheetActivate" event fires.
Excel passes the sheet name through the variable "Sh".

SheetName = "Sheet1" -- Here you replace "Sheet1" with the name of
the sheet you want to capture.


If Sh.Name = SheetName Then
'PLACE YOUR CODE HERE
End If

Please, let me know if that solve your ploblem.

regards.

Juan Carlos


--
cscorp
------------------------------------------------------------------------
cscorp's Profile:

http://www.excelforum.com/member.php...o&userid=24015
View this thread: http://www.excelforum.com/showthread...hreadid=376995



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
Copy Sheet action very slow RobN[_3_] Excel Discussion (Misc queries) 0 June 27th 07 03:32 AM
Action on sheet Selection Piranha[_9_] Excel Programming 0 June 7th 05 08:59 AM
How to action on Open Sheet Jan Nademlejnsky Excel Programming 1 December 8th 04 06:03 AM
onClick action from cell selection Beanymonster Excel Programming 4 July 16th 04 09:25 PM


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