Cant eliminate screen flicker

zeppidoo

New Member
Joined
Jan 5, 2017
Messages
8
I have a macro/vba that copies data from cells on 1 sheet and pastes it to cells in a different sheet. I cant seem to get rid of the screen flicker. I tried using Application.ScreenUpdating = False
at the beginning of my code but it did not seem to eliminate everything. I still see the cells only that are being pasted to and only when they are being activated.
I am a novice with VBA and I am sure my code is not the most efficient, could that be causing the flicker?
 

Some videos you may like

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

AlphaFrog

MrExcel MVP
Joined
Sep 2, 2009
Messages
16,400
Eliminate lines in your code that .Select or .Activate. They're usually not needed. If you post your code, lots of people in the forum can show you how to do it.
 

zeppidoo

New Member
Joined
Jan 5, 2017
Messages
8
My code is below, as I mentioned I am a novice and I am just limping my way through this. this is my first VBA project so any help or suggestions would be appreciated. Sorry its so long.
Code:
Sub calculate()
'
' calculate Macro
' Keyboard Shortcut: Ctrl l
' Application.ScreenUpdating = False
' Application.EnableEvents = False
'
   Application.calculate
   
    Sheets("log").Visible = True
    Range("H3").Select
    Selection.Copy
    Sheets("Log").Select
    Range("A1").Select
    Selection.End(xlDown).Select
    ActiveCell.Offset(1, 0).Range("A1").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    ActiveCell.Offset(0, 1).Range("A1").Select
    Sheets("Parcel OB").Select
    Range("B18").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Log").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    ActiveCell.Offset(0, 1).Range("A1").Select
    Sheets("Parcel OB").Select
    Range("C18").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Log").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    ActiveCell.Offset(0, 1).Range("A1").Select
    Sheets("Parcel OB").Select
    Range("D18").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Log").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    ActiveCell.Offset(0, 1).Range("A1").Select
    Sheets("Parcel OB").Select
    Range("E18").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Log").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    ActiveCell.Offset(0, 1).Range("A1").Select
    Sheets("Parcel OB").Select
    Range("F18").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Log").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    ActiveCell.Offset(0, 1).Range("A1").Select
    Sheets("Parcel OB").Select
    Range("B21").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Log").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    ActiveCell.Offset(0, 1).Range("A1").Select
    Sheets("Parcel OB").Select
    Range("C21").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Log").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    ActiveCell.Offset(0, 1).Range("A1").Select
    Sheets("Parcel OB").Select
    Range("D21").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Log").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    ActiveCell.Offset(0, 1).Range("A1").Select
    Sheets("Parcel OB").Select
    Range("E21").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Log").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    ActiveCell.Offset(0, 1).Range("A1").Select
    Sheets("Parcel OB").Select
    Range("F21").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Log").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    ActiveCell.Offset(0, 1).Range("A1").Select
    Sheets("Parcel OB").Select
    Range("B23").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Log").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    ActiveCell.Offset(0, 1).Range("A1").Select
    Sheets("Parcel OB").Select
    Range("C23").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Log").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    ActiveCell.Offset(0, 1).Range("A1").Select
    Sheets("Parcel OB").Select
    Range("D23").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Log").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    ActiveCell.Offset(0, 1).Range("A1").Select
    Sheets("Parcel OB").Select
    Range("E23").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Log").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    ActiveCell.Offset(0, 1).Range("A1").Select
    Sheets("Parcel OB").Select
    Range("F23").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Log").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Sheets("Parcel OB").Select
    Range("B1").Select
    Sheets("Log").Visible = False
    'Application.ScreenUpdating = True
    'Application.EnableEvents = True

    
End Sub

[code]
 

AlphaFrog

MrExcel MVP
Joined
Sep 2, 2009
Messages
16,400
Code:
[COLOR=darkblue]Sub[/COLOR] Log_Calculations()
[COLOR=green]'[/COLOR]
[COLOR=green]' Log_Calculations Macro[/COLOR]
[COLOR=green]' Keyboard Shortcut: Ctrl l[/COLOR]
    
    Application.ScreenUpdating = [COLOR=darkblue]False[/COLOR]
    
    Application.Calculate
    
    [COLOR=green]'Sheets("log").Visible = True[/COLOR]
    
    [COLOR=darkblue]With[/COLOR] Sheets("Log").Range("A1").End(xlDown).Offset(1, 0)
        
        Sheets("Parcel OB").Range("H3").Copy
        .PasteSpecial Paste:=xlPasteValues
        
        Sheets("Parcel OB").Range("B18:F18").Copy
        .Offset(0, 1).PasteSpecial Paste:=xlPasteValues
        
        Sheets("Parcel OB").Range("B21:F21").Copy
        .Offset(0, 6).PasteSpecial Paste:=xlPasteValues
        
        Sheets("Parcel OB").Range("B23:F23").Copy
        .Offset(0, 11).PasteSpecial Paste:=xlPasteValues
        
    [COLOR=darkblue]End[/COLOR] [COLOR=darkblue]With[/COLOR]
    
    Application.CutCopyMode = [COLOR=darkblue]False[/COLOR]
    
    [COLOR=green]'Sheets("Log").Visible = False[/COLOR]
    
    Application.ScreenUpdating = [COLOR=darkblue]True[/COLOR]
    
[COLOR=darkblue]End[/COLOR] [COLOR=darkblue]Sub[/COLOR]
 
Last edited:

zeppidoo

New Member
Joined
Jan 5, 2017
Messages
8
This worked perfectly, I think I understand what I did wrong. Thank you so much for your help :)
 

Watch MrExcel Video

Forum statistics

Threads
1,127,744
Messages
5,626,622
Members
416,195
Latest member
tonmcg

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top