Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
famdamly
 
Posts: n/a
Default Run a macro from cell select


What's the secret to doing this I can't find nothing on it?

I need to execute a macro that will involve using data from the row
that is selected. I don't want to write 50 macros with 50 buttons. It
seems there would be a way of having a macro assigned to a cell in row
1. Then copy and paste it all the way down the column.

The other way would be to have the user make a selection, basically
highlighting the data, then pressing a button to execute a macro. The
problem for me is, I don't know how the macro will know which row,
column or cell is selected.

Please help. I'm stuck.


--
famdamly
------------------------------------------------------------------------
famdamly's Profile: http://www.excelforum.com/member.php...o&userid=29382
View this thread: http://www.excelforum.com/showthread...hreadid=518403

  #2   Report Post  
Posted to microsoft.public.excel.misc
L. Howard Kittle
 
Posts: n/a
Default Run a macro from cell select

Perhaps something like this, expanded to suit:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Row = 1 And Target.Column = 1 Then RC1
If Target.Row = 2 And Target.Column = 1 Then RC2
End Sub

Sub RC1()
MsgBox "Run macro for row 1"
End Sub

Sub RC2()
MsgBox "Run macro for row 2"
End Sub

HTH
Regards,
Howard

"famdamly" wrote in
message ...

What's the secret to doing this I can't find nothing on it?

I need to execute a macro that will involve using data from the row
that is selected. I don't want to write 50 macros with 50 buttons. It
seems there would be a way of having a macro assigned to a cell in row
1. Then copy and paste it all the way down the column.

The other way would be to have the user make a selection, basically
highlighting the data, then pressing a button to execute a macro. The
problem for me is, I don't know how the macro will know which row,
column or cell is selected.

Please help. I'm stuck.


--
famdamly
------------------------------------------------------------------------
famdamly's Profile:
http://www.excelforum.com/member.php...o&userid=29382
View this thread: http://www.excelforum.com/showthread...hreadid=518403



  #3   Report Post  
Posted to microsoft.public.excel.misc
famdamly
 
Posts: n/a
Default Run a macro from cell select


That's great Howard.

The only problem is I don't know how to reference the activated cell or
row # to have the macro know what row# so it could use that # to gather
other related data.


--
famdamly
------------------------------------------------------------------------
famdamly's Profile: http://www.excelforum.com/member.php...o&userid=29382
View this thread: http://www.excelforum.com/showthread...hreadid=518403

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
Urgent date/scheduling calc needed jct Excel Worksheet Functions 3 February 24th 06 01:36 AM
copying cell names Al Excel Discussion (Misc queries) 12 August 11th 05 03:01 PM
macro help thephoenix12 Excel Discussion (Misc queries) 4 July 15th 05 05:57 PM
Possible Lookup Table Karen Excel Worksheet Functions 5 June 8th 05 09:43 PM
Copy cell format to cell on another worksht and update automatical kevinm Excel Worksheet Functions 21 May 19th 05 11:07 AM


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

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"