Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Form Button - Select Row
Hello all,
I'm looking to create a macro which will run from a Form Button. Form buttons will be located at the end of each row. How can I make the form button select the cells in the row that the form button is on? For example if the active cell is c12 and I press the form button at the end of row 5 the macro runs fine but it runs on the data in row 12 rather than row 5 (basically it copies that data and moves it somewhere else). Any help appreciated. Paul. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Form Button - Select Row
You can try this
Sub Button1_Click() Dim rw As Long rw = Range(ActiveSheet.Shapes(Application.Caller).TopLe ftCell.Address).Row Range(Cells(rw, "A"), Cells(rw, "D")).Select End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "Paul Brown" wrote in message ... Hello all, I'm looking to create a macro which will run from a Form Button. Form buttons will be located at the end of each row. How can I make the form button select the cells in the row that the form button is on? For example if the active cell is c12 and I press the form button at the end of row 5 the macro runs fine but it runs on the data in row 12 rather than row 5 (basically it copies that data and moves it somewhere else). Any help appreciated. Paul. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Form Button - Select Row
Thanks Ron,
Exactly what I was looking for - works a treat. Paul. "Ron de Bruin" wrote in message ... You can try this Sub Button1_Click() Dim rw As Long rw = Range(ActiveSheet.Shapes(Application.Caller).TopLe ftCell.Address).Row Range(Cells(rw, "A"), Cells(rw, "D")).Select End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "Paul Brown" wrote in message ... Hello all, I'm looking to create a macro which will run from a Form Button. Form buttons will be located at the end of each row. How can I make the form button select the cells in the row that the form button is on? For example if the active cell is c12 and I press the form button at the end of row 5 the macro runs fine but it runs on the data in row 12 rather than row 5 (basically it copies that data and moves it somewhere else). Any help appreciated. Paul. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Form Button - Select Row
Sub button1_click() Dim shp As Shape Dim rng As Range Set shp = ActiveSheet.Shapes(Application.Caller) Set rng = shp.BottomRightCell.EntireRow rng.Select End Sub run from the click event -- tony h ------------------------------------------------------------------------ tony h's Profile: http://www.excelforum.com/member.php...o&userid=21074 View this thread: http://www.excelforum.com/showthread...hreadid=503367 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Form Button - Select Row
Thanks Tony.
Paul. "tony h" wrote in message ... Sub button1_click() Dim shp As Shape Dim rng As Range Set shp = ActiveSheet.Shapes(Application.Caller) Set rng = shp.BottomRightCell.EntireRow rng.Select End Sub run from the click event -- tony h ------------------------------------------------------------------------ tony h's Profile: http://www.excelforum.com/member.php...o&userid=21074 View this thread: http://www.excelforum.com/showthread...hreadid=503367 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
I wan to select a button | Excel Discussion (Misc queries) | |||
Can't select macro button after other button is pressed | Excel Programming | |||
Pause macro, add form button to sheet, continue macro when button clicked! | Excel Programming | |||
Command Button vs Form Button | Excel Programming | |||
Select all/Deselect all button in a form | Excel Programming |