Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default Can a macro be triggered when a cell is selected?

Hi,

I'm trying to have a macro executed when a specific cell in the spreadsheet
is selected. Is there a way to do this? What would the code look like?

Thanks for your help!!

Robert
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default Can a macro be triggered when a cell is selected?

You can use the worksheet selection change event to do this. Right click on
the sheet tab and select view code. Paste this macro onto the code sheet and
change as required to run specific code or call another macro. PS change the
cell reference to whatever is appropriate - currently set to A10.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$A$10" Then
MsgBox "Your macro here"
End If
End Sub

Hope this helps
Rowan

"Linking to specific cells in pivot table" wrote:

Hi,

I'm trying to have a macro executed when a specific cell in the spreadsheet
is selected. Is there a way to do this? What would the code look like?

Thanks for your help!!

Robert

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default Can a macro be triggered when a cell is selected?

Thanks Rowan!!

"Rowan" wrote:

You can use the worksheet selection change event to do this. Right click on
the sheet tab and select view code. Paste this macro onto the code sheet and
change as required to run specific code or call another macro. PS change the
cell reference to whatever is appropriate - currently set to A10.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$A$10" Then
MsgBox "Your macro here"
End If
End Sub

Hope this helps
Rowan

"Linking to specific cells in pivot table" wrote:

Hi,

I'm trying to have a macro executed when a specific cell in the spreadsheet
is selected. Is there a way to do this? What would the code look like?

Thanks for your help!!

Robert

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
Macro for a one time triggered copy of cell value Azrael[_2_] Excel Discussion (Misc queries) 8 March 4th 09 04:24 PM
Macro to transfer contents of 'Selected' cell to alternate cell. Gryndar Excel Worksheet Functions 7 December 20th 08 09:58 PM
run macro when cell is selected beauty_bobaloo Excel Worksheet Functions 9 January 30th 06 11:11 PM
Macro triggered by an event AussieAVguy Excel Discussion (Misc queries) 2 June 16th 05 05:51 AM
macro triggered by a change to a cell Lee Excel Programming 2 July 3rd 04 12:04 AM


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