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

Help needed to changing color in a textbox with a macro

pandoram316

New Member
Hello.

I am trying to have a macro change the color of the text in a textbox countdown timer to Red when the timer hits 30 seconds.

Here is what I have so far.

Can someone help me with it. It should be a black background (which it has) with white font, which it has and as soon as 30 seconds hits, the font turns red.

Thank you
Code:
Sub nexttick()
If Sheet4.Range("C1") = 0 Then Exit Sub
Sheet4.Range("C1").Value = Sheet4.Range("C1").Value - TimeValue("00:00:01")
If Sheet4.Range("C1").Value <= TimeValue("00:00:30") Then
Sheet4.Shapes("TextBox 1").Fill.ForeColor.RGB = RGB(0, 0, 0)
Else
Sheet4.Shapes("TextBox 1").Fill.ForeColor.RGB = RGB(0, 0, 0)
End If
starttimer
End Sub
 
Last edited by a moderator:
Red should be:
Sheet1.Shapes("TextBox 1").Fill.ForeColor.RGB = RGB(255, 0, 0)
 
Red should be:
Sheet1.Shapes("TextBox 1").Fill.ForeColor.RGB = RGB(255, 0, 0)

Thank you for your reply.

That code makes the textbox background red. I need a code that makes the text in the textbox red once the countdown timer hits 30 seconds.
 
Code:
  Sheet1.Shapes.Range(Array("Textbox 1")).Select
  Selection.ShapeRange.TextFrame2.TextRange.Font.Fill.ForeColor.RGB = RGB(255, 0, 0)
 
Back
Top