Hi All,
I have a code that compares data using countif function, If I have too many data to calculate, my excel file will freeze that is why Id like to add a "Progress Bar" in my code. I already have one but only shows in Application.StatusBar.
Id like to have a form to show the progress,I found some sites with tutorial but does not fit with my code. I hope somebody could help me. Id like to have like this one. Progress Indicator in Excel VBA - Easy Excel Macros
Hope someone can relate my code to this site.
Here is my code
Thank you!
I have a code that compares data using countif function, If I have too many data to calculate, my excel file will freeze that is why Id like to add a "Progress Bar" in my code. I already have one but only shows in Application.StatusBar.
Id like to have a form to show the progress,I found some sites with tutorial but does not fit with my code. I hope somebody could help me. Id like to have like this one. Progress Indicator in Excel VBA - Easy Excel Macros
Hope someone can relate my code to this site.
Here is my code
Code:
Sub Checker()
'
' Macro Checker
'
Dim LastRow1 As Long
Dim LastRow2 As Long
Dim LastRow3 As Long
Dim x As Integer
Dim Str As String
Dim pctCompl As Single
Sheets("Checker").Visible = True
'/// Builder
Application.ScreenUpdating = False
Sheets("Checker").Select
Range("A2").Select
ActiveCell.FormulaR1C1 = _
"=CLEAN(TRIM(Builder!RC))&CLEAN(TRIM(Builder!RC[1]))&CLEAN(TRIM(Builder!RC[2]))&CLEAN(TRIM(Builder!RC[3]))&CLEAN(TRIM(Builder!RC[4]))&CLEAN(TRIM(Builder!RC[5]))&CLEAN(TRIM(Builder!RC[6]))&CLEAN(TRIM(Builder!RC[7]))&CLEAN(TRIM(Builder!RC[8]))&CLEAN(TRIM(Builder!RC[9]))"
LastRow1 = Sheets("Builder").Cells(Rows.Count, "A").End(xlUp).Row
LastRow1 = LastRow1 + 1
On Error Resume Next
Selection.AutoFill Destination:=Range("A2:A" & LastRow1)
'/// SAP Export
Sheets("Checker").Select
Range("B2").Select
ActiveCell.FormulaR1C1 = _
"=TRIM('SAP Export'!RC[-1])&TRIM('SAP Export'!RC)&TRIM('SAP Export'!RC[1])&TRIM('SAP Export'!RC[2])&TRIM('SAP Export'!RC[3])&TRIM('SAP Export'!RC[4])&TRIM('SAP Export'!RC[5])&TRIM('SAP Export'!RC[6])&TRIM('SAP Export'!RC[7])&TRIM('SAP Export'!RC[8])"
LastRow2 = Sheets("SAP Export").Cells(Rows.Count, "A").End(xlUp).Row
LastRow2 = LastRow2 + 1
On Error Resume Next
Selection.AutoFill Destination:=Range("B2:B" & LastRow2)
'/// Countif Checker
Sheets("Checker").Select
Range("C2").Select
x = Sheets("Checker").Cells(Rows.Count, "A").End(xlUp).Row
For Xloop = 2 To x
Str = "=IF(COUNTIF($B$2:$B$" & x & ",A" & Xloop & ")>0,""OK"",""MISSING"")"
'MsgBox Str
Sheets("Checker").Range("C" & Xloop).Value = Str
'Application.StatusBar = "Progress: " & Xloop & " of " & x & ": " & Format(Xloop / x, "0%") ' progressbar
Next
Application.StatusBar = False
Sheets("Checker").Range("C2:C" & x).Copy
Sheets("Builder").Select
Range("K2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Checker").Visible = False
Application.ScreenUpdating = True
Application.StatusBar = False
End Sub
Thank you!