Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default determine row reference from button

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default determine row reference from button

I got a private response pointing out my typo:

For the Forms version:

Option Explicit

Sub mybuttonclick()
Dim myBTN As Button
Set myBTN = ActiveSheet.Buttons(Application.Caller)
MsgBox myBTN.TopLeftCell.Address & _
vbLf & myBTN.TopLeftCell.Row & _
vbLf & myBTN.TopLeftCell.Column
End Sub

(sorry)


Dave Peterson wrote in message ...
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

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
I don't have the relative reference button . why? hutcher Excel Discussion (Misc queries) 1 March 23rd 07 01:05 AM
How to determine button reference Lon Sarnoff Setting up and Configuration of Excel 1 June 4th 05 04:22 AM
RELATIVE REFERENCE BUTTON Neil Mark Excel Discussion (Misc queries) 2 February 22nd 05 07:27 AM
Determine which button Senile Excel Programming 2 November 20th 03 11:21 PM
How to determine which button was clicked on the modified right-click menu Patrick Choi Excel Programming 1 September 1st 03 02:07 PM


All times are GMT +1. The time now is 08:43 PM.

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"