Hi VBAers,
As I delve deeper into excel I am learning many more exciting functions but am also coming up against many more problems!
Is there a way to use a "for...next" loop in order to copy the below code 300 times? i.e. I have 300 different text boxes that are conditionally formatted individually based on 300 different cells. If i have a list of the textboxes and a list of the cells could i use a loop to make this happen? or am i best to copy the code 300 times and manually update it?
Any help would be much appreciated!
As I delve deeper into excel I am learning many more exciting functions but am also coming up against many more problems!
Is there a way to use a "for...next" loop in order to copy the below code 300 times? i.e. I have 300 different text boxes that are conditionally formatted individually based on 300 different cells. If i have a list of the textboxes and a list of the cells could i use a loop to make this happen? or am i best to copy the code 300 times and manually update it?
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Sheets("Aust Fixed").Range("B272") > 0 Then
Sheets("Australia").Shapes("TextBox 406").Select
With Selection.Font
.Color = RGB(0, 0, 0)
End With
ElseIf Sheets("Aust Fixed").Range("B272") < 0 Then
Sheets("Australia").Shapes("TextBox 406").Select
With Selection.Font
.Color = RGB(255, 0, 0)
End With
End If
End Sub
Any help would be much appreciated!