Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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
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
Push button and input box? tripflex Excel Discussion (Misc queries) 2 March 6th 09 03:36 PM
Time with the push of one button Dale G[_2_] New Users to Excel 7 August 6th 08 01:55 PM
push a command button donbowyer Excel Programming 3 September 10th 06 12:36 AM
Push the button chris Excel Programming 1 August 3rd 05 04:07 PM
Which button did I push Daniel Bonallack[_2_] Excel Programming 4 May 20th 04 09:12 PM


All times are GMT +1. The time now is 06:14 AM.

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"