Status bar counter

scsnow

New Member
Joined
Aug 14, 2013
Messages
11
Hello all,

I need some help to add a vba counter to the status bar when running a vba loop? I know I need to use Application.StatusBar, but can't get it to run.

Code:
Sub ENGINE_24MTH()Dim dvCell As Range
Dim inputRange As Range
Dim c As Range
Dim i As Long




'Which cell has data validation
Set dvCell = Worksheets("UNIT ECONOMICS 24MTH").Range("E3")
'Determine where validation comes from
Set inputRange = Evaluate(dvCell.Validation.Formula1)


i = 2
'Begin our loop
Application.ScreenUpdating = False
Application.CutCopyMode = False
   


For Each c In inputRange
    dvCell = c.Value
    Worksheets("UNIT ECONOMICS 24MTH").Range("CopyRange").Copy
    Worksheets("OUTPUT_24").Cells(i, "A").PasteSpecial xlPasteValues
    i = i + 721
Next c
Application.ScreenUpdating = True
Application.CutCopyMode = True


MsgBox "Model update complete"


End Sub
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Try with this:

Code:
Sub ENGINE_24MTH()
    Dim dvCell As Range
    Dim inputRange As Range
    Dim c As Range
    Dim i As Long
    Dim n As Integer
    'Which cell has data validation
    Set dvCell = Worksheets("UNIT ECONOMICS 24MTH").Range("E3")
    'Determine where validation comes from
    Set inputRange = Evaluate(dvCell.Validation.Formula1)
    i = 2
    n = 1
    'Begin our loop
    Application.ScreenUpdating = False
    Application.CutCopyMode = False
    Application.StatusBar = False
    For Each c In inputRange
        Application.StatusBar = "Copying the range : " & n
        dvCell = c.Value
        Worksheets("UNIT ECONOMICS 24MTH").Range("CopyRange").Copy
        Worksheets("OUTPUT_24").Cells(i, "A").PasteSpecial xlPasteValues
        i = i + 721
        n = n + 1
    Next c
    Application.ScreenUpdating = True
    Application.CutCopyMode = True
    Application.StatusBar = False
    MsgBox "Model update complete"
End Sub

Regards Dante Amor
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,844
Members
449,051
Latest member
excelquestion515

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