• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA Macro while running i need progress bar

Rajendar

Member
Hi,

Please help me. I need progress bar in userform when i running the Macro 1-100%

I tried but i can able to do it.

Please help me.

the sheet is attached
 

Attachments

Hui

Excel Ninja
Staff member
Change the code for the PSI_Stock_Sheet code module to:

Code:
Sub PSI_Stock_Sheet()
Dim i As Integer
Dim condition As Range
Dim pctd As Double

For i = 4 To 30
  
Sheet3.Cells(i, 11) = WorksheetFunction.SumIfs(PSIINWARD.Range("P3:P2000"), PSIINWARD.Range("L3:L2000"), Sheet3.Cells(i, 3), PSIINWARD.Range("L3:L2000"), Sheet3.Cells(i, 3), PSIINWARD.Range("L3:L2000"), Sheet3.Cells(i, 3))
Sheet3.Cells(i, 12) = WorksheetFunction.SumIfs(Sheet6.Range("J3:J1000"), Sheet6.Range("F3:F1000"), Sheet3.Cells(i, 3), Sheet6.Range("F3:F1000"), Sheet3.Cells(i, 3), Sheet6.Range("F3:F1000"), Sheet3.Cells(i, 3))
Sheet3.Cells(i, 13) = WorksheetFunction.SumIfs(MIV.Range("N3:N10000"), MIV.Range("I3:I10000"), Sheet3.Cells(i, 3), MIV.Range("I3:I10000"), Sheet3.Cells(i, 3), MIV.Range("I3:I10000"), Sheet3.Cells(i, 3))
Sheet3.Cells(i, 14) = WorksheetFunction.SumIfs(Sheet9.Range("I3:I500"), Sheet9.Range("D3:D500"), Sheet3.Cells(i, 3), Sheet9.Range("D3:D500"), Sheet3.Cells(i, 3), Sheet9.Range("D3:D500"), Sheet3.Cells(i, 3))
Sheet3.Cells(i, 15) = WorksheetFunction.SumIfs(Sheet5.Range("J3:J500"), Sheet5.Range("E3:E500"), Sheet3.Cells(i, 3), Sheet5.Range("E3:E500"), Sheet3.Cells(i, 3), Sheet5.Range("E3:E500"), Sheet3.Cells(i, 3))


  'Added by Hui
  pctd = (i - 3) / (30 - 4)
  With UserForm1
  .FrameProgress.Caption = Application.WorksheetFunction.Text(pctd, "0.0%") 'Changed
  .LabelProgress.Width = pctd * (.FrameProgress.Width - 10)
  .Label2.Caption = "Processing row: " + CStr(i)
  End With

  DoEvents

  Application.StatusBar = "Progress: " + CStr(i - 3) + " of " + CStr(30 - 4) + ": " + Application.WorksheetFunction.Text(pctd, "#.0%") 'Changed

Next i

MsgBox " Process Complete"
UserForm1.Hide

ActiveWorkbook.save
End Sub
 

Rajendar

Member
Thanks for your help sir

its working with in excel 2013 also.

fine.


The same way i created userform1 in another excel file. changing of file name and module names. still there are some error. Last 2-3 days i am trying this. but i can't able to do this. i request you please help me in this also.

i know i am doing mistake in vba somewhere i cant able to find the problem. Please see the attachment
 

Attachments

Top