Movable Macro button

jrisebo

Active Member
Joined
Mar 15, 2011
Messages
312
Office Version
  1. 365
Platform
  1. Windows
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?
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
something like:
Code:
button1.top = Range("A567").top
?
 
Upvote 0
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
 
Upvote 0
What type Button is this?
A Activex Button
A Form control Button
A Shape Button
 
Upvote 0
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.
 
Upvote 0
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
 
Upvote 0
You will have to include any code needed to move the button in the code for Worksheet Selection Change Event.
 
Upvote 0

Forum statistics

Threads
1,216,566
Messages
6,131,441
Members
449,652
Latest member
ylsteve

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top