Macros button move by themselves

Solved
El-sol -  
 El-sol -
Hello,

I have several macros that I have assigned to buttons that we see in a worksheet. They are located next to, to the right of a chart.
The problem is that sometimes, when I reopen my file, the buttons are moved up across my numbers, and they are smaller, all huddled together.
Is it because of the chart?
I had placed them there because it's related to the chart. Instead of going to modify the data selection (since there are several lines to modify every month, and in about thirty files), I created macro buttons for each month of the year. We just have to click on them and it fetches the numbers from the other sheets to update the sales table.
It's frustrating that the buttons don't stay in place.
Why?

Thanks.

4 answers

El-sol
 
Hello,

thank you for the information. I didn't know about this little hook that makes all the difference. We'll see later if the buttons will stay in place.

But regarding the "Sub Auto_Open," where can I find that?
is it in the VBA? I'm not very experienced with macros.

thank you
3
Frenchie83 Posted messages 2254 Status Member 339
 
Hello
In the properties of the buttons, have you checked "Don't move or size with cells"?
On another note, among all your macros, is there one called "Sub Auto_open" by any chance, which might modify the format of the sheet?
If not, use the macro recorder to place your buttons in the right spots and rename that macro "Sub Auto_Open", then your problem will be solved.
Have a nice day
Best regards
0
Frenchie83 Posted messages 2254 Status Member 339
 
Hello
Yes, it's in VBA, but since you know how to assign macros to buttons, what I'm suggesting is child's play.
Press Alt + F11 (to access the VBA modules)
to add a module, click on "Insert" in the module ribbon
and select "Module".
Paste the following code:
Sub Auto_open() Application.ScreenUpdating = False 'prevents flickering of the sheet ActiveSheet.Shapes("Button 1").Select 'put the button number to position Selection.ShapeRange.Left = 200 'position relative to the left edge of the sheet Selection.ShapeRange.Top = 100 'position relative to the top left of the sheet Selection.ShapeRange.Width = 150 'Width of the button Selection.ShapeRange.Height = 100 'Height of the button End Sub
, each line is commented
all you have to do is put the correct button number in line 2 (to find out, go back to your Excel sheet, right-click on the button, and look in the name box (to the left of the formula bar) to note the assigned number.
Then run the macro, if everything goes well, have fun changing the position values until you find what works for you.
Hoping I was able to help you.
best regards
0
El-sol
 
I'm going to keep that in mind but I won't touch my macros for the moment.
I just added the bracket to keep them in place.
I have 12 macro buttons (one for each month), so it's quite a lot to add your auto_open sub code and modify the location for each one.
As long as they stay in place, I'm happy.

Thank you.
0