I have written code to copy paste certain rows from one workbook to another. I want a progress bar to show me the progress of the job taking into account each row pasted. For example: If I have to copy-paste 10 rows, then once 1 row is pasted it should show: 10% completed.
This is a snippet of my code:
Sub Automate_Estimate()
Set Wb = ThisWorkbook
MyFile = Application.GetOpenFilename(FileFilter:="Excel Files,*.xl*;*.xm*")
Set wkb = Workbooks.Open(MyFile, UpdateLinks:=0)
Application.StatusBar = "Copying In progress..." & Cells(Rows.Count, 2).End(xlUp).Row & "% completed"
Debug.Print MyFile, DestName
Set rng = Sheets(SourceName).Range("C12:R12")
rng.Copy
Wb.Sheets(DestName).Cells(1, 2).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Set rng = Sheets(SourceName).Range("C30:R30")
rng.Copy
Wb.Sheets(DestName).Cells(24, 2).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Set rng = Sheets(SourceName).Range("C22:R22")
rng.Copy
Wb.Sheets(DestName).Cells(4, 2).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Set rng = Sheets(SourceName).Range("C20:R20")
rng.Copy
Wb.Sheets(DestName).Cells(14, 2).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Set rng = Sheets(SourceName).Range("C40:R40")
rng.Copy
Wb.Sheets(DestName).Cells(17, 2).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Set rng = Sheets(SourceName).Range("C16:R16")
rng.Copy
Wb.Sheets(DestName).Cells(7, 2).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Set rng = Sheets(SourceName).Range("C17:R17")
rng.Copy
Wb.Sheets(DestName).Cells(8, 2).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Set rng = Sheets(SourceName).Range("C21:R21")
rng.Copy
Wb.Sheets(DestName).Cells(16, 2).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Set rng = Sheets(SourceName).Range("C52:R52")
rng.Copy
Wb.Sheets(DestName).Cells(56, 2).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.StatusBar = "Copying Is complete"
wkb.Close
End Sub
The progress bar code is after 'Set wkb' (After line 2). The data is being pasted from the 2nd column. Can somebody help me with this? Thanks :)