Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Excel: Fixed Button Position

Needing some help attaching an Excel/VBA button on an Excel sheet. I need it to stay in the same position on the screen regardless of how I scroll or zoom. Preferably, I need this on the bottom left or right of the screen.

I have tried adding a button. Then, I right clicked on the button. Clicked on Format Controls -> Properties -> selected Don't Move or Size With Cells. Am I missing something that's making this not work?

Thanks!

like image 358
4 revs, 4 users 69% Avatar asked Jan 15 '13 19:01

4 revs, 4 users 69%


People also ask

How do I freeze a macro button in Excel?

Hold Ctrl and click as many buttons as you want, then let go of Ctrl and drag the selected buttons where you want.

How do I move a button in Excel?

Control click or right-click on the button, then click anywhere else in the workbook, the button should be like the following image, then put your cursor on it to check if you can move it. 4.


1 Answers

I know this post is old, but here's to anyone it could be useful. The VisibleRange property of ActiveWindow can solve this problem. Use something like this:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    With ActiveSheet.OLEObjects("MY_BUTTON'S_NAME")
        .Top = ActiveWindow.VisibleRange.Top + ActiveWindow.VisibleRange.Height - 5
        .Left = ActiveWindow.VisibleRange.Left + ActiveWindow.VisibleRange.Width - .Width - 5
    End With
End Sub
like image 80
baz Avatar answered Oct 08 '22 18:10

baz