• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Scrolling question

Right click the Tab for SHEET1. Left click on VIEW CODE.

In the large white area on the right hand side, paste the following :

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
    Dim MyPicture As Object
    Dim MyTop As Double
    Dim MyLeft As Double
    Dim BottomRightCell As Range
    '-----------------------------------------------------------
    '- bottom right cell
    With ActiveWindow.VisibleRange
        r = .Rows.Count
        c = .Columns.Count
        Set BottomRightCell = .Cells(r, c)
    End With
    '------------------------------------------------------------
    '- position picture
    Set MyPicture = ActiveSheet.Pictures(1)
    MyTop = BottomRightCell.Top - MyPicture.Height - 5
    MyLeft = BottomRightCell.Left - MyPicture.Width - 5
    With MyPicture
        .Top = MyTop
        .Left = MyLeft
    End With
End Sub

Go back to SHEET1 and insert a .JPG image on the sheet.

Scroll the sheet down, left click anywhere.
Scroll again, left click anywhere.

Refer to attached example file.
 

Attachments

  • Scrolling Pic.xlsb
    119.7 KB · Views: 1
Back
Top