Shape Moving

mudflap

New Member
Joined
Sep 26, 2009
Messages
34
I have a macro assigned to a shape and I would like it to follow the page as I scroll down is this possible?

Thanks
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Try this:

This script will follow the active cell.
So when you click on a cell the shape will be next to the active cell.

This is an auto sheet event script
Your Workbook must be Macro enabled
To install this code:
Right-click on the sheet tab
Select View Code from the pop-up context menu
Paste the code in the VBA edit window

I named my shape MY_Shape.
Modify name to your needs.


Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Modified  11/16/2018  7:29:50 AM  EST
Shapes("My_Shape").Top = ActiveCell.Top
Shapes("My_Shape").Left = ActiveCell.Offset(, 1).Left
End Sub
 
Upvote 0
Is it possible to put this code in my Persional.XLSB so it will automatically run on all of my workbooks? I have a lot of worksheets in each workbook and i don't want to have to put this code in each sheet.

Thanks
 
Upvote 0
No. As far as I know a sheet selection change event cannot be installed in the Personal Workbook.

Tell me what do you do with this shape. Do you have a script assigned to this shape.

I may have another way we could do this. Is your whole ideal to have this button close by so you can click it to run a script?

If so post the script here.
 
Last edited:
Upvote 0
Now that I look at your original post again I see you have a script assigned to the shape.

Why not run the script with a shortcut key. Then this script could be installed in the Personal Workbook and could be run in any sheet or workbook.
 
Upvote 0
I cant seem to get that to work.

I think some thing needs to be charged in the code in order for it to work. I will keep trying otherwise ill just start putting the code in each sheet.

Thank you for the help.
 
Upvote 0
Not sure what your saying. I asked what is your script in the shape doing. I said show me your script. And you did not answer my question.
I cant seem to get that to work.

I think some thing needs to be charged in the code in order for it to work. I will keep trying otherwise ill just start putting the code in each sheet.

Thank you for the help.
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,175
Members
452,615
Latest member
bogeys2birdies

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