View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_3_] Dave Peterson[_3_] is offline
external usenet poster
 
Posts: 2,824
Default determine row reference from button

Where did you get the button?

if from the Forms toolbar:

sub mybuttonclick()
dim myBTN as button
set mybtn = activesheet.buttons(application.caller)
msgbox mybtn.address & vblf & mybtn.row & vblf & mybtn.column
end sub

if from the Control toolbox:
Private Sub CommandButton1_Click()
msgbox me.commandbutton1.row
end sub

mark wrote:

I'm creating a timesheet and need a button to copy data
from one column to others for the specific row the button
is on.

I've created a button click which passes the row reference
(value is assigned to click event) across to the function
which does the copying.

Problem is, I can't seem to get the row reference value
(to pass to function) based on the location of the button.

Is there a way to get this row reference from the button
location or another way?

I really don't want to have to create a click event for
each and every button and lock in the row reference ,
cause there is loads of them.

Many thanks in advance

mark


--

Dave Peterson