Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy Push Button and VB Functionality
I am new to using VB with excel, so please be gental. I am trying to
duplicat a push button that was created for one row of cells. I want all other rows of cells to have their own push buton with the same funcationality only using the data from their row and output to their row. How can this be done without creating each buttno and its VB code from scratch? Like when you select a funtion and copy it to other cells. The function is moved and then the cells that it is usnign are updated with the move. Is there a way to attach a Push Button to a cell and then have the cells location as an input parameter to the VB init? Thanks, Jeff |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy Push Button and VB Functionality
if you use a push button from the forms toolbar, you can assign a single
macro to each button. Public Sub pButton_Click() Dim rng as Range, rw as Long Dim sName as String, btn as Button sName = Application.Caller set btn = Activesheet.buttons(sname) set rng = btn.TopLeftCell ' or .BottomRightCell rw = rng.row msgbox sname & ": " & rng.Address(0,0) End Sub as an example. -- Regards, Tom Ogilvy "SystemParametersInfo -Kokomo" wrote: I am new to using VB with excel, so please be gental. I am trying to duplicat a push button that was created for one row of cells. I want all other rows of cells to have their own push buton with the same funcationality only using the data from their row and output to their row. How can this be done without creating each buttno and its VB code from scratch? Like when you select a funtion and copy it to other cells. The function is moved and then the cells that it is usnign are updated with the move. Is there a way to attach a Push Button to a cell and then have the cells location as an input parameter to the VB init? Thanks, Jeff |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy Push Button and VB Functionality
Thanks Tom,
But how can I call my VB code from there? My current button opens a dialog box that will then open different forms based on the users selection. "Tom Ogilvy" wrote: if you use a push button from the forms toolbar, you can assign a single macro to each button. Public Sub pButton_Click() Dim rng as Range, rw as Long Dim sName as String, btn as Button sName = Application.Caller set btn = Activesheet.buttons(sname) set rng = btn.TopLeftCell ' or .BottomRightCell rw = rng.row msgbox sname & ": " & rng.Address(0,0) End Sub as an example. -- Regards, Tom Ogilvy "SystemParametersInfo -Kokomo" wrote: I am new to using VB with excel, so please be gental. I am trying to duplicat a push button that was created for one row of cells. I want all other rows of cells to have their own push buton with the same funcationality only using the data from their row and output to their row. How can this be done without creating each buttno and its VB code from scratch? Like when you select a funtion and copy it to other cells. The function is moved and then the cells that it is usnign are updated with the move. Is there a way to attach a Push Button to a cell and then have the cells location as an input parameter to the VB init? Thanks, Jeff |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Copy Push Button and VB Functionality
Oh man...I did not see it at first. Now I get it. I will dig in further,
but it looks like this might work for me. Thanks again. "SystemParametersInfo -Kokomo" wrote: Thanks Tom, But how can I call my VB code from there? My current button opens a dialog box that will then open different forms based on the users selection. "Tom Ogilvy" wrote: if you use a push button from the forms toolbar, you can assign a single macro to each button. Public Sub pButton_Click() Dim rng as Range, rw as Long Dim sName as String, btn as Button sName = Application.Caller set btn = Activesheet.buttons(sname) set rng = btn.TopLeftCell ' or .BottomRightCell rw = rng.row msgbox sname & ": " & rng.Address(0,0) End Sub as an example. -- Regards, Tom Ogilvy "SystemParametersInfo -Kokomo" wrote: I am new to using VB with excel, so please be gental. I am trying to duplicat a push button that was created for one row of cells. I want all other rows of cells to have their own push buton with the same funcationality only using the data from their row and output to their row. How can this be done without creating each buttno and its VB code from scratch? Like when you select a funtion and copy it to other cells. The function is moved and then the cells that it is usnign are updated with the move. Is there a way to attach a Push Button to a cell and then have the cells location as an input parameter to the VB init? Thanks, Jeff |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Push button and input box? | Excel Discussion (Misc queries) | |||
Time with the push of one button | New Users to Excel | |||
push a command button | Excel Programming | |||
Push the button | Excel Programming | |||
Which button did I push | Excel Programming |