Movable Macro button

jrisebo

Board Regular
Joined
Mar 15, 2011
Messages
221
I have a macro that takes you to the next open line in a series of data. I would like it to follow the current row you are in, so If I am in row 567, I would like the button to be somewhat close to that row. Any ideas?
 

jrisebo

Board Regular
Joined
Mar 15, 2011
Messages
221
something like:
Code:
button1.top = Range("A567").top
?
I guess i wasnt clear. I want it to follow me, as I click a row. So it would vary. If cell A1000 is selected, I want the button to be in F1000, and so fourth.
I
 

igold

Well-known Member
Joined
Jul 8, 2014
Messages
2,450
Office Version
365, 2010
Platform
Windows
How about something like this to line up the top of the button with the top of the row of the current activecell.

This is assuming that the height of your rows are all uniform and that in this instance the row height is 18.00

Code:
ActiveSheet.Shapes("PartsButton1").Top = (ActiveCell.Row() * 18) - 18
Change "PartsButton1" to the name of your button.
 

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
16,421
If your using a Shape for a Button

Try this:

Code:
Sub Move_Button()
'Modified 6/20/2019 4:11:41 PM  EDT
Dim v As String
v = Application.Caller
With ActiveSheet.Shapes(v)
    .Left = ActiveCell.Left
    .Top = ActiveCell.Offset(5).Top
End With
End Sub
 

bobsan42

Well-known Member
Joined
Jul 14, 2010
Messages
1,283
You will have to include any code needed to move the button in the code for Worksheet Selection Change Event.
 

Forum statistics

Threads
1,085,420
Messages
5,383,560
Members
401,837
Latest member
steve37777

Some videos you may like

This Week's Hot Topics

Top