close

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: www.excelforum.com/member.php...oamp;userid=29382
View this thread: www.excelforum.com/showthread...hreadid=518403Perhaps 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 quot;Run macro for row 1quot;
End Sub

Sub RC2()
MsgBox quot;Run macro for row 2quot;
End Sub

HTH
Regards,
Howard

quot;famdamlyquot; gt; wrote in
message ...
gt;
gt; What's the secret to doing this I can't find nothing on it?
gt;
gt; I need to execute a macro that will involve using data from the row
gt; that is selected. I don't want to write 50 macros with 50 buttons. It
gt; seems there would be a way of having a macro assigned to a cell in row
gt; 1. Then copy and paste it all the way down the column.
gt;
gt; The other way would be to have the user make a selection, basically
gt; highlighting the data, then pressing a button to execute a macro. The
gt; problem for me is, I don't know how the macro will know which row,
gt; column or cell is selected.
gt;
gt; Please help. I'm stuck.
gt;
gt;
gt; --
gt; famdamly
gt; ------------------------------------------------------------------------
gt; famdamly's Profile:
gt; www.excelforum.com/member.php...oamp;userid=29382
gt; View this thread: www.excelforum.com/showthread...hreadid=518403
gt;

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: www.excelforum.com/member.php...oamp;userid=29382
View this thread: www.excelforum.com/showthread...hreadid=518403quot;activecell.rowquot; will give you the row number. I must not have a full grip
on what you want to do.

If you want, send me a sample workbook and some detail of what you are after
and I will give it a go.
Regards,
Howard

quot;famdamlyquot; gt; wrote in
message ...
gt;
gt; What's the secret to doing this I can't find nothing on it?
gt;
gt; I need to execute a macro that will involve using data from the row
gt; that is selected. I don't want to write 50 macros with 50 buttons. It
gt; seems there would be a way of having a macro assigned to a cell in row
gt; 1. Then copy and paste it all the way down the column.
gt;
gt; The other way would be to have the user make a selection, basically
gt; highlighting the data, then pressing a button to execute a macro. The
gt; problem for me is, I don't know how the macro will know which row,
gt; column or cell is selected.
gt;
gt; Please help. I'm stuck.
gt;
gt;
gt; --
gt; famdamly
gt; ------------------------------------------------------------------------
gt; famdamly's Profile:
gt; www.excelforum.com/member.php...oamp;userid=29382
gt; View this thread: www.excelforum.com/showthread...hreadid=518403
gt;

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()