Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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
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 wan to select a button Happy Excel Discussion (Misc queries) 3 September 24th 08 01:19 AM
Can't select macro button after other button is pressed C. Campbell Excel Programming 1 November 30th 04 07:46 PM
Pause macro, add form button to sheet, continue macro when button clicked! Flystar[_15_] Excel Programming 1 May 26th 04 09:45 AM
Command Button vs Form Button T K Excel Programming 4 August 26th 03 07:26 PM
Select all/Deselect all button in a form Stuart[_5_] Excel Programming 2 August 6th 03 07:55 PM


All times are GMT +1. The time now is 07:23 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"