Hi
This is the code I have:
What I need it to do is:
if the font is black, do nothing
otherwise change to interior color
This piece is not working as it's just changing all to match interior so I think my IF statement is off?
then I have another sub which I'm hoping to change just the ones to interior to a blue.
I.e. ignore any font in black and show rest as blue
Once I work out the above if, I guess I can adapt the below as similar?
then I've wrapped this in a toggle button:
this is driving me crazy so really appreciate any advice please!
This is the code I have:
Code:
Private Sub HideFont()
Dim cell As Variant
Dim rng As Range
Set rng = Range("Table1[Country]")
For Each cell In rng
If cell.Font.Color <> 1 Then
cell.Font.Color = cell.Interior.Color
End If
Next cell
End Sub
What I need it to do is:
if the font is black, do nothing
otherwise change to interior color
This piece is not working as it's just changing all to match interior so I think my IF statement is off?
then I have another sub which I'm hoping to change just the ones to interior to a blue.
I.e. ignore any font in black and show rest as blue
Once I work out the above if, I guess I can adapt the below as similar?
Code:
Sub UnhideFont()
Dim cell As Variant
Dim rng As Range
Set rng = Range("Table1[Country]")
For Each cell In rng
cell.Font.Color = 25
Next cell
End Sub
then I've wrapped this in a toggle button:
Code:
Private Sub ToggleButton2_Click()
If ToggleButton2.Value = True Then
'This area contains the things you want to happen
'when the toggle button is not depressed
UnhideFont
Else
'This area contains the things you want to happen
'when the toggle button is depressed
HideFont
End If
End Sub
this is driving me crazy so really appreciate any advice please!