• 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.

I need help with my progress bar to change color when percentage advance!

Hello,

I am trying to find a way of making the progress bar change color when the percentage goes from 0 to 100. Is it possible?
I made a simple userform with a simple Progress Bar. The file is already attached.


Thank you so much in advance.
 

Attachments

  • Progress Bar.xlsm
    28.5 KB · Views: 9
Does this work for you?

Code:
Private Sub UserForm_Activate()
Dim remainder As Long
Dim i As Long, j As Long
remainder = 0
For i = 1 To 200

    UserForm1.Label2.Width = UserForm1.Label2.Width + 1
    If i Mod 2 = 0 Then
    remainder = remainder + 1
    UserForm1.Caption = remainder & " % complete"
    UserForm1.Label2.Caption = remainder & "%"
    End If
    For j = 1 To 600
        DoEvents
    Next j
Next i
BackColor = &HFFFF&
MsgBox "File has been loaded succesfully!"
Unload UserForm1
End Sub
 
I actually like this one better

Code:
Private Sub UserForm_Activate()
Dim remainder As Long
Dim i As Long, j As Long
remainder = 0
For i = 1 To 200

    UserForm1.Label2.Width = UserForm1.Label2.Width + 1
    If i Mod 2 = 0 Then
    remainder = remainder + 1
    UserForm1.Caption = remainder & " % complete"
    UserForm1.Label2.Caption = remainder & "%"
    End If
    For j = 1 To 600
        DoEvents
    Next j
Next i
UserForm1.Label2.BackColor = &HFFFF&
MsgBox "File has been loaded succesfully!"
Unload UserForm1
End Sub
 
Does this work for you?

Code:
Private Sub UserForm_Activate()
Dim remainder As Long
Dim i As Long, j As Long
remainder = 0
For i = 1 To 200

    UserForm1.Label2.Width = UserForm1.Label2.Width + 1
    If i Mod 2 = 0 Then
    remainder = remainder + 1
    UserForm1.Caption = remainder & " % complete"
    UserForm1.Label2.Caption = remainder & "%"
    End If
    For j = 1 To 600
        DoEvents
    Next j
Next i
BackColor = &HFFFF&
MsgBox "File has been loaded succesfully!"
Unload UserForm1
End Sub

It did not work but thank you for trying!
 
I actually like this one better

Code:
Private Sub UserForm_Activate()
Dim remainder As Long
Dim i As Long, j As Long
remainder = 0
For i = 1 To 200

    UserForm1.Label2.Width = UserForm1.Label2.Width + 1
    If i Mod 2 = 0 Then
    remainder = remainder + 1
    UserForm1.Caption = remainder & " % complete"
    UserForm1.Label2.Caption = remainder & "%"
    End If
    For j = 1 To 600
        DoEvents
    Next j
Next i
UserForm1.Label2.BackColor = &HFFFF&
MsgBox "File has been loaded succesfully!"
Unload UserForm1
End Sub

It worked better. But is it possible the bar changes color when it reaches 25%, another color when it reaches 50%, Another color when it reaches 75%, and another color on 100% reaching? Is it possible?
 
Back
Top