I have a macro that generates a report, and it takes a minute or two to execute. Is there any way I can create a progress bar to show the user how close it is to being done? I googled it, but didn't come up with anything that I could figure out how to apply to my code. My macro is this:
It runs each of those loops 6 times with diffferent values for the variables and different arguments within the do while loops.
Thanks!
Hank
Code:
Private Sub MyMacro()
Dim R As Long
Dim S As Long
Dim T As Long
S = 10
R = 11
T = 18
Sheets("Optics Report").Activate
Do While (S < 71)
ActiveSheet.Range("C" & S & ":C" & (S - 1)).Value = Sheets("Image Intensifying Optics").Range("C" & (T) & ":C" & (T - 1)).Value
ActiveSheet.Range("E" & S & ":E" & (S - 1)).Value = Sheets("Image Intensifying Optics").Range("E" & (T) & ":E" & (T - 1)).Value
ActiveSheet.Range("M" & S).Value = Sheets("Image Intensifying Optics").Range("M" & (T)).Value
ActiveSheet.Range("P" & (S - 1) & ":P" & (S + 2)).Value = Sheets("Image Intensifying Optics").Range("P" & (T - 1) & ":P" & (T + 2)).Value
ActiveSheet.Range("Q" & (S - 1) & ":T" & (S + 2)).Value = Sheets("Image Intensifying Optics").Range("Q" & (T - 1) & ":T" & (T + 2)).Value
S = S + 4
T = T + 4
Loop
Do While (R < 73)
If ActiveSheet.Range("Q" & R) = "" Then
Sheets("Optics Report").Range("M" & R & ":M" & (R + 1)).EntireRow.Hidden = True
Else
Sheets("Optics Report").Range("M" & R & ":M" & (R + 1)).EntireRow.Hidden = False
End If
R = R + 4
Loop
R = 10
T = 1
Do While (R < 71)
If ActiveSheet.Range("M" & R) = "" Then
Sheets("Optics Report").Range("C" & R & ":C" & (R - 1)).EntireRow.Hidden = True
Else
Sheets("Optics Report").Range("C" & R & ":C" & (R - 1)).EntireRow.Hidden = False
Sheets("Optics Report").Range("A" & R & ":A" & (R - 1)).Value = T
T = T + 1
End If
R = R + 4
Loop
It runs each of those loops 6 times with diffferent values for the variables and different arguments within the do while loops.
Thanks!
Hank