TimeValue in Macro linked to cell in worksheet

armchairandy

Board Regular
Joined
Mar 27, 2012
Messages
53
Hi

I have the below progress bar which goes from 10% to 100% changing every 2 seconds and runs in the status bar. This works fine..

I run 12 main macros that need the progress bar to run and each macro will have a variable amount of records to process, and changes each time I use the worksheet. I know how many records the macros can process each 60 seconds so I can work out the overall run time approximately (and divide by ten for each segment). This can be added to a sheet in the workbook, for each individual macro as I will know how many records are to be processed before I run each macro automatically.


But I would like to add a couple of tweaks:

1. How do I run this at the same time as "Macro #1 "
2. How do I change the colour - at the moment its dark blue and a lighter colour would stand out better- Green, Red or Orange maybe?.
3. Can I add an approximate time remaining to the progress bar in the status area ie after the text?.
Most importantly....
4. How do I link the TimeValue("00:00:02") to a cell, so the macro takes the new time from the updated formula in the worksheet?. This would be the same value 10 times.

Any help would be really appreciated

Andrew

Sub ShowProgress()
' make StatusBar visible

Application.DisplayStatusBar = True
'First Segment
Application.StatusBar = String(1, ChrW(9609)) & "Macro #1 Missing Links: 10% Complete....."
Application.Wait Now + TimeValue("00:00:02")
'Second Segment
Application.StatusBar = String(2, ChrW(9609)) & "Macro #1 Missing Links: 20% Complete....."
Application.Wait Now + TimeValue("00:00:02")
'Third Segment
Application.StatusBar = String(3, ChrW(9609)) & "Macro #1 Missing Links: 30% Complete....."
Application.Wait Now + TimeValue("00:00:02")
'Fourth Segment
Application.StatusBar = String(4, ChrW(9609)) & "Macro #1 Missing Links: 40% Complete....."
Application.Wait Now + TimeValue("00:00:02")
'Fifth Segment
Application.StatusBar = String(5, ChrW(9609)) & "Macro #1 Missing Links: 50% Complete....."
Application.Wait Now + TimeValue("00:00:02")
'Sixth Segment
Application.StatusBar = String(6, ChrW(9609)) & "Macro #1 Missing Links: 60% Complete....."
Application.Wait Now + TimeValue("00:00:02")
'Seventh Segment
Application.StatusBar = String(7, ChrW(9609)) & "Macro #1 Missing Links: 70% Complete....."
Application.Wait Now + TimeValue("00:00:02")
'Eighth Segment
Application.StatusBar = String(8, ChrW(9609)) & "Macro #1 Missing Links: 80% Complete....."
Application.Wait Now + TimeValue("00:00:02")
'Ninth Segment
Application.StatusBar = String(9, ChrW(9609)) & "Macro #1 Missing Links: 90% Complete....."
Application.Wait Now + TimeValue("00:00:02")
'Tenth Segment
Application.StatusBar = String(10, ChrW(9609)) & "Macro #1 Missing Links: 100% Complete"
Application.Wait Now + TimeValue("00:00:02")

'Relinquish the StatusBar
Application.StatusBar = False
End Sub
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type

Forum statistics

Threads
1,224,823
Messages
6,181,169
Members
453,021
Latest member
Justyna P

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