To complete Progress Bar indicator level to 100%

  • Thread starter Thread starter ilyaskazi
  • Start date Start date
I

ilyaskazi

To complete Progress Bar indicator level to 100% once.

Assume my total Rows are 5000.
While going through each rows counting increase by 1 for displaying
indicator level.
If it reaches 100 it starts again from 1 to display until it completes
5000.

But i don't want to display it again-n-again. Instead to finish it
showing once.
My maths is very poor so i m unable to do the calculation to make it
5000 = 100.

So plz help to complete this indicator level to display 100%
accordingly on completing the total rows
 
Update your progress counter by the ratio of total records to 100 each time.

So with 5000 records only update 5000/100 = every 50 records.

One way of applying this is to use the modulus function

If recC Mod 50 then UpdateProgress

where recC = current record count
every 50 records the UpdateProgress action will be triggered.
 
Sorry should have read ......

If recC Mod 50 = 0 then UpdateProgress

--
Cheers
Nigel



Nigel said:
Update your progress counter by the ratio of total records to 100 each time.

So with 5000 records only update 5000/100 = every 50 records.

One way of applying this is to use the modulus function

If recC Mod 50 then UpdateProgress

where recC = current record count
every 50 records the UpdateProgress action will be triggered.
 
I hv problem basically in updating my progress bar for comparing
sheets.
Sheets are compared between say "MYSHEET1" with "MYSHEET2" or "RULES1"
with "RULES2"

I need to update my progress bar for going through each row.
Assume my total columns are 30 and total rows are 541.

Below are my codes which compares sheets and mark invalid to
differences.
In box type comment code is my problem mark with # to update my
progress bar.

1-

Code:
--------------------

Sub CompareSheets_APFM()
Dim CmpSheets As New Collection
Dim i, sh, ce

Application.DisplayAlerts = False
Application.ScreenUpdating = False

For i = 1 To Sheets.count '<<<...determine comparison sheet names
On Error Resume Next
CmpSheets.Add Item:=Left(Sheets(i).Name, Len(Sheets(i).Name) - 1), _
Key:=Left(Sheets(i).Name, Len(Sheets(i).Name) - 1)
Next i

For Each sh In CmpSheets

With Sheets(sh & 1) 'Sheets of File-1
LastColumn1 = .UsedRange.Columns.count
LastRow1 = .UsedRange.Rows.count
End With
With Sheets(sh & 2) 'Sheets of File-2
LastColumn2 = .UsedRange.Columns.count
LastRow2 = .UsedRange.Rows.count
End With

If LastColumn1 > LastColumn2 Then '<< determine Ending comparison column
EndCol = LastColumn1
cmpCn = "" & GetXLColName(EndCol - 1) 'get column name (A-Z)
Else
EndCol = LastColumn2
cmpCn = "" & GetXLColName(EndCol - 1)
End If
If LastRow1 > LastRow2 Then '<< determine Ending comparison row
EndRow = LastRow1
Else
EndRow = LastRow2
End If

iCnt1 = EndRow * EndCol
iPro1 = 0

For Each ce In Range("A1:" & cmpCn & EndRow)

'################################################
'#If Not iPro1 = ce.Row Then: iPro1 = iPro1 + ce.Row 'problem is here
'################################################

cData1 = LTrim(Sheets(sh & 1).Range(ce.Address).Value)
cData2 = LTrim(Sheets(sh & 2).Range(ce.Address).Value)

If cData1 <> cData2 Then
'>> Mark Error
Sheets(sh & 1).Range(ce.Address).Interior.ColorIndex = 3
Sheets(sh & 1).Range(ce.Address).Font.ColorIndex = 2
Sheets(sh & 2).Range(ce.Address).Interior.ColorIndex = 3
Sheets(sh & 2).Range(ce.Address).Font.ColorIndex = 2

End If

Call SPKR.ProgressBar(Int(iPro1 * 100 / iCnt1))

Next ce
MsgBox "Finish- " & iPro1

Next sh

Application.DisplayAlerts = True
Application.ScreenUpdating = True

End Sub

--------------------

2-

Code:
--------------------

Sub ProgressBar(ProgPercent As Integer) 'Update Progress Bar

With Me
.MeterBar1.Width = (.ProgBar1.Width / 100) * ProgPercent - 1
.ProgBar1.Caption = ProgPercent & "%"
If ProgPercent >= 50 Then .ProgBar1.ForeColor = 16777215
DoEvents
End With

End Sub
--------------------


Kindly help plzzz

also posted:
http://www.ozgrid.com/forum/showthread.php?t=41075
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top