Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
cpmittal
 
Posts: n/a
Default How to run a macro when a worksheet is selected


Can anyone help how to autrun a macro when a worksheet is selected.


--
cpmittal
------------------------------------------------------------------------
cpmittal's Profile: http://www.excelforum.com/member.php...o&userid=25641
View this thread: http://www.excelforum.com/showthread...hreadid=390498

  #2   Report Post  
aristotle
 
Posts: n/a
Default

Hi,

This works whenever a change is made within a worksheet, will it do?

Go to VBE (Alt + F11). Find the sheet you want to apply this to within
Project-VBA Project. Double click the sheet and paste:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
YourMacro
End Sub

Change "YourMacro" to the code you want to run.

Regards,
A

"cpmittal" wrote:


Can anyone help how to autrun a macro when a worksheet is selected.


--
cpmittal
------------------------------------------------------------------------
cpmittal's Profile: http://www.excelforum.com/member.php...o&userid=25641
View this thread: http://www.excelforum.com/showthread...hreadid=390498


  #3   Report Post  
Bob Phillips
 
Posts: n/a
Default

Us

Private Sub Worksheet_Activate()
YourMacro
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"aristotle" wrote in message
...
Hi,

This works whenever a change is made within a worksheet, will it do?

Go to VBE (Alt + F11). Find the sheet you want to apply this to within
Project-VBA Project. Double click the sheet and paste:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
YourMacro
End Sub

Change "YourMacro" to the code you want to run.

Regards,
A

"cpmittal" wrote:


Can anyone help how to autrun a macro when a worksheet is selected.


--
cpmittal
------------------------------------------------------------------------
cpmittal's Profile:

http://www.excelforum.com/member.php...o&userid=25641
View this thread:

http://www.excelforum.com/showthread...hreadid=390498




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
Setting up a form to input into selected worksheet Bob Excel Discussion (Misc queries) 0 June 29th 05 10:53 PM
Search/Match between 2 x separate Worksheets and populate result in third worksheet Alan Bartley Excel Discussion (Misc queries) 1 April 11th 05 05:21 AM
Turn off hyperlinks in a selected worksheet Jaybird Excel Discussion (Misc queries) 1 April 9th 05 03:04 PM
can I print selected cells only within a worksheet martin hanley New Users to Excel 1 January 4th 05 08:07 PM
Executing macro for all worksheet from a different worksheet Biti New Users to Excel 3 December 8th 04 10:05 AM


All times are GMT +1. The time now is 01:42 AM.

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

About Us

"It's about Microsoft Excel"