Consulting

Results 1 to 4 of 4

Thread: Screen Refresh

  1. #1
    VBAX Regular
    Joined
    Oct 2010
    Location
    Texas
    Posts
    93
    Location

    Screen Refresh

    Hello Everyone,

    I need your help. I'm using code to copy a small .jpeg from one worsheet to another within the same workbook. There are about 30 If then conditions used to determine where the pic will be pasted. As copying is done the screen flickers. Below is the first part of the code I'm using. Can you help me modify it so the screen doesn't flicker when the pic is being copied.

    Thank you in advance for any help you can provide!!


    Sub CopyWHMSTRPic()
    Dim ws As Worksheet
    Set ws = ActiveSheet


    Application.ScreenUpdating = False

    If Range("InputbxS").Value = "RS" And Range("InputJ").Value = "Tp3" Then

    ws.Range("i33:ab45").CopyPicture
    Worksheets("WH Master").Activate
    Worksheets("WH Master").Range("c22").Activate
    Worksheets("WH Master").Paste
    End If
    Application.ScreenUpdating = True
    wksNewOrder.Activate
    Range("A1").Select
    Range("OrderNumber").Select

  2. #2
    VBAX Mentor
    Joined
    Jun 2004
    Posts
    363
    Location
    I'm seeing no flicker with the bit of code you've posted. Is this the complete code?

    You an avoid the Activating of the sheet and range in this section:
    [VBA]Worksheets("WH Master").Activate
    Worksheets("WH Master").Range("c22").Activate
    Worksheets("WH Master").Paste[/VBA]

    by using

    [VBA]Worksheets("WH Master").Range("c22").PasteSpecial
    [/VBA]

    For readability of your posted code, please remember to use the VBA tags.

  3. #3
    VBAX Regular
    Joined
    Oct 2010
    Location
    Texas
    Posts
    93
    Location
    There are about 30 If Then statements below the code that I posted. There all basically the same If Then statements just with different values and destinations for the pic. Pls advise

    Thank you.

  4. #4
    VBAX Mentor
    Joined
    Jun 2004
    Posts
    363
    Location
    I'd advise to post the entire code. Without seeing it there is no way to know what it is doing.


    One possiblity:
    Is your entire module surrounded by the
    Application.ScreenUpdating = False
    ...... your code ......
    Application.ScreenUpdating = True

    Your snippet shows that you turn the ScreenUpdating back on after the If statement. You should only turn it back on after the entire code has run.

Posting Permissions

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