How to make a shape/button floats with scrolling down in VBA?

  • After 10 minutes of internet research, I could not get the answer, then I decided to post here!

    I use the following code in the Worksheet_SelectionChange event, which only triggers when (as you expect) the selection changes!

    What should I do in order to make it work as I scroll down using the scroll sidebar?


    1. With Me.Shapes("Shape1")
    2. .Top = ActiveWindow.VisibleRange.Top + 250
    3. .Left = ActiveWindow.VisibleRange.Left + 630
    4. End With
  • The following paste in a Routine Module:

    The following paste in ThisWorkbook module :

    1. Option Explicit
    2. Private Sub Workbook_BeforeClose(Cancel As Boolean)
    3. StopTimer
    4. End Sub
    5. Private Sub Workbook_Open()
    6. StartTimedRefresh
    7. End Sub