Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
I don't have the relative reference button . why? | Excel Discussion (Misc queries) | |||
How to determine button reference | Setting up and Configuration of Excel | |||
RELATIVE REFERENCE BUTTON | Excel Discussion (Misc queries) | |||
Determine which button | Excel Programming | |||
How to determine which button was clicked on the modified right-click menu | Excel Programming |