Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2006

Tip: Looking for answers? Try searching our database.

Form Button - Select Row

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Paul Brown - 20 Jan 2006 15:42 GMT
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.
Ron de Bruin - 20 Jan 2006 16:00 GMT
You can try this

Sub Button1_Click()
   Dim rw As Long
   rw = Range(ActiveSheet.Shapes(Application.Caller).TopLeftCell.Address).Row
   Range(Cells(rw, "A"), Cells(rw, "D")).Select
End Sub

Signature

Regards Ron de Bruin
http://www.rondebruin.nl

> Hello all,
>
[quoted text clipped - 6 lines]
>
> Paul.
Paul Brown - 20 Jan 2006 16:15 GMT
Thanks Ron,

Exactly what I was looking for - works a treat.

Paul.

> You can try this
>
[quoted text clipped - 17 lines]
>>
>> Paul.
tony h - 20 Jan 2006 16:24 GMT
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

Signature

tony h

Paul Brown - 21 Jan 2006 13:44 GMT
Thanks Tony.

Paul.

> Sub button1_click()
> Dim shp As Shape
[quoted text clipped - 8 lines]
>
> run from the click event
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.