Can VBA code be less glitchy?

Millsio88

New Member
Joined
May 1, 2020
Messages
11
Office Version
  1. 2016
Platform
  1. Windows
Can my code be less glitchy when it’s coping data from one tab to another?

When i select input from tab 2 it flickers between tab 1 & 2. How can it be smoother?

Sub CopySource()
Dim wsData As Worksheet
Dim iRow As Long
Set wsData = Sheets("Input")
Set wsT = Sheets("Tracker")
Set work = Sheets("Workings")

If Worksheets("Tracker").FilterMode = True Then
Worksheets("Tracker").ShowAllData
End If

'Tracker
With Worksheets("Tracker")
iRow = .Cells(Rows.Count, 2).End(xlUp).Row + 1
wsData.Range("C6").Copy
.Range("B" & iRow).PasteSpecial Paste:=xlPasteValuesAndNumberFormats
wsData.Range("C7").Copy
.Range("C" & iRow).PasteSpecial Paste:=xlPasteValuesAndNumberFormats
wsData.Range("C8").Copy
.Range("D" & iRow).PasteSpecial Paste:=xlPasteValuesAndNumberFormats
wsData.Range("C10").Copy
.Range("E" & iRow).PasteSpecial Paste:=xlPasteValuesAndNumberFormats
wsData.Range("C11").Copy
.Range("F" & iRow).PasteSpecial Paste:=xlPasteValuesAndNumberFormats
wsData.Range("F6").Copy
.Range("G" & iRow).PasteSpecial Paste:=xlPasteValuesAndNumberFormats
wsData.Range("F7").Copy
.Range("H" & iRow).PasteSpecial Paste:=xlPasteValuesAndNumberFormats

If work.Range("B1") = True Then
wsT.Range("J" & iRow).Value = "ü"
Else
wsT.Range("J" & iRow).Value = "û"
End If

If work.Range("B2") = True Then
wsT.Range("N" & iRow).Value = "ü"
Else
wsT.Range("N" & iRow).Value = "û"
End If

If work.Range("B3") = True Then
wsT.Range("R" & iRow).Value = "ü"
Else
wsT.Range("R" & iRow).Value = "û"
End If

If work.Range("B4") = True Then
wsT.Range("V" & iRow).Value = "ü"
Else
wsT.Range("V" & iRow).Value = "û"
End If

If work.Range("B5") = True Then
wsT.Range("Z" & iRow).Value = "ü"
Else
wsT.Range("Z" & iRow).Value = "û"
End If

If wsData.Range("B6") = True Then
wsT.Range("AD" & iRow).Value = "ü"
Else
End If

If work.Range("B7") = True Then
wsT.Range("AE" & iRow).Value = "ü"
Else
End If

If work.Range("B8") = True Then
wsT.Range("AF" & iRow).Value = "ü"
Else
End If

wsData.Range("C13").Copy
.Range("AG" & iRow).PasteSpecial Paste:=xlPasteValuesAndNumberFormats
wsData.Range("F8").Copy
.Range("AI" & iRow).PasteSpecial Paste:=xlPasteValuesAndNumberFormats
Application.CutCopyMode = False
End With
End Sub

I also need to add the code to move the scroll back to J from AJ on tracker Sheet as I’ve freeze’d panels from I7 if there are an answers?
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Try a structure like this

VBA Code:
Sub CopySource()
  'Dim statements here
  
  Application.ScreenUpdating = False
  
  'Rest of your code here
  
  Application.ScreenUpdating = True
End Sub
 
Upvote 0
Solution
Try a structure like this

VBA Code:
Sub CopySource()
  'Dim statements here
 
  Application.ScreenUpdating = False
 
  'Rest of your code here
 
  Application.ScreenUpdating = True
End Sub
Thanks, this has reduced the glitch, it's still flickers a little but not so much that it flicks between the 2 different sheets. Cheers
 
Upvote 0

Forum statistics

Threads
1,214,971
Messages
6,122,520
Members
449,088
Latest member
RandomExceller01

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
Back
Top