VBA code to display the status of the row being processed...

rca

Board Regular
Joined
Mar 1, 2005
Messages
182
Hello Everyone!

I have a macro that processes data one row at a time in column C. I would like to show a message in the status bar. This message will tell the user which row is being processed. Right now, my macro has this statement:

Application.StatusBar = "Now processing column C. Please wait..."

How can I amend this code to tell the user WHICH ROW is being processed while he/she is waiting for the macro to complete?

Something like this maybe: "Now processing Row 27 in Column C. Please wait..."

If it helps, the macro starts processing at row 8. Currently, there are about 247 rows. But, we add more rows each day.

Thank you!!
Rachel :biggrin: :biggrin:
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
How about posting the code you've got now?

I'd imagine that you can use whatever varible you're using to work on each row.

Smitty
 
Upvote 0
Rachel

Can you post your current code?
Code:
For I = 8 To 255
    Application.StatusBar  = "Now processing Row " & I &" in Column C. Please wait..."
Next I
 
Upvote 0
Sorry! It is column "B" that I am processing! Here is my code...

Code:
Private Sub CalculateValues_Click()

    Dim SalesCodes As Range
    Dim c As Range
    
    Set SalesCodes = Range("B8", Range("B8").End(xlDown))
    
    Range("DA7:DE7").Value = Range("AA7:AE7").Value
    
    Application.StatusBar = "Now processing column B. Please wait..." 
    
    For Each c In SalesCodes
        Range("DA8:DE8").Value = c.Offset(, 25).Resize(, 5).Value
        
        With c.Offset(, 7)
            .Formula = "=DSUM(SalesLedger,""Values"", DA7:DE8)"
            .Value = .Value
        End With
    
    Next c
    
    Range("DA7:DE8").ClearContents
    
    Application.StatusBar = False

End Sub

Is is also possible to "extract out" the SalesCode in column "B"? So, as each row is being processed, the message would indicate the row AND the associated SalesCode.

For instance, the message in the status bar would say something like:

"Now processing Row 27 in Column B [sales code here]. Please wait..."

Thank you very much!!!
Rachel :biggrin: :biggrin:
 
Upvote 0
Rachel

Perhaps something like this.
Code:
Application.StatusBar = "Now processing Row " & c.Row & " in column B - " & c.Value & " Please wait..."
Which would go in the loop.

By the way what's the actual purpose of the code?
 
Upvote 0
Hi Norie,
This code works perfectly. Thank you! This codes reads a database and summarizes our sales figues (albeit in a very inefficient way).

Hi Smitty,
Thank you for your help also!

I wish both of you a great day!

Rachel :biggrin: :biggrin:
 
Upvote 0
Rachel

Do you really need code?

Have you considered a pivot table?

Or even formulas?

Having/wanting to display the status suggests to me that the code is taking some time to execute.

Is that the case?
 
Upvote 0
Yes, Norie. It is taking about 1 minute of so to execute. It's a giant database. I think maybe a pivot table would make more sense.
 
Upvote 0
Rachel

Well why not give a try.:)

And post back if you need any further help.
 
Upvote 0

Forum statistics

Threads
1,214,924
Messages
6,122,294
Members
449,077
Latest member
Rkmenon

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