Results 1 to 3 of 3

Thread: Copy picture

  1. #1
    Lounger
    Join Date
    Feb 2009
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I want to write a macro that copies a range of cells as a picture, then re-sizes the picture and pastes it to another spreadsheet without screen the flickering (it is somewhat anoying).

    The following code works for Copy (without screen flickering) but crashes for CopyPicture:
    Sheets(1).Range("A14").Copy destination:=Sheets(2).Range("E5")

    The follwing code works for Copy and CopyPicture but the screen flickers (when sheet(4) is selected)
    Sheets(1).Range("A2:G8").CopyPicture
    Sheets(4).Paste Destination:=Sheet(4).Range("J1")

    Is there someway to add a picture from the clipboard to prevent screen flickering? Maybe something along the line...
    Sheets(1).Range("A2:G8").CopyPicture
    Set myshape = Sheets(4).Shapes.AddPicture(from clipboard?, etc., etc.)

  2. #2
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post
    Hi Santford

    Your code seems to work OK on a test Excel file I have, is it a large workbook full of data you are using? When I used just text in the range it was pretty quick but when I used formulas it did flicker slightly until I used this piece of code:

    Code:
    Sub CopyPicture()
    Application.ScreenUpdating = False
    
            Sheets(1).Range("A2:G8").CopyPicture
            Sheets(4).Paste Destination:=Sheets(4).Range("J1")
    
    Application.ScreenUpdating = True
    End Sub

    The Application.ScreenUpdating= False/True did the job
    Jerry

  3. #3
    Lounger
    Join Date
    Feb 2009
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks, that works!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •