EinarOSies
Board Regular
- Joined
- Feb 15, 2021
- Messages
- 61
- Office Version
- 2019
- Platform
- Windows
Please I am new to VBA. this code runs the first procedure when I type a number from 1 to 100 but it stops when it is more than 100. Due to that, I had wanted to add an elseif to make the wordart red but it doesn't. Please and also if I add a formula the code does not run.
For correction how can this code work with a formula when the number is between 1 to 100 but will turn red when it is more than 100
For correction how can this code work with a formula when the number is between 1 to 100 but will turn red when it is more than 100
VBA Code:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Target.Address = "$A$4" Then
If IsNumeric(Target.Value) Then
With Shapes("Rectangle 4").TextFrame2.TextRange.Font.Fill
.TwoColorGradient msoGradientHorizontal, 1
.GradientAngle = 270
.GradientStops(1).Color = RGB(0, 0, 0)
.GradientStops(1).Position = Target.Value
.GradientStops(2).Color = RGB(255, 255, 255)
.GradientStops(2).Position = Target.Value
End With
End If
ElseIf Target.Address > "100%" Then
With Shapes("Rectangle 4").TextFrame2.TextRange.Font.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(0, 0, 0)
.BackColor.RGB = RGB(255, 255, 255)
.TwoColorGradient msoGradientHorizontal, 2
End With
'End If 'isnumric
End If
End Sub