pk247
11-25-2014, 03:34 PM
Hi All,
I'm trying to write the code below to change any cells where if the cell font in the range is Black then change it to xlautomatic so that subsequent code can sort each column by other colours. Could someone please advise where I'm going wrong?
Sub ChangeBlackFonttoAuto()
Application.ScreenUpdating = False
Sheets("Tracker").Select
Range("A1:z500").Select
For Each cell In Selection
If cell.Font.Color = RGB(0, 0, 0) Then
cell.Font.ColorIndex = xlAutomatic
End If
Next
Application.ScreenUpdating = True
End Sub
The code just removes all text for some reason! I also recorded a macro to see what the original font was that I need to change but I can't get it to work. Can someone please help me? My brain is starting to hurt now... Thanks! Paul, Ireland
Range("D30:G30").Select
With Selection.Font
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
End With
I'm trying to write the code below to change any cells where if the cell font in the range is Black then change it to xlautomatic so that subsequent code can sort each column by other colours. Could someone please advise where I'm going wrong?
Sub ChangeBlackFonttoAuto()
Application.ScreenUpdating = False
Sheets("Tracker").Select
Range("A1:z500").Select
For Each cell In Selection
If cell.Font.Color = RGB(0, 0, 0) Then
cell.Font.ColorIndex = xlAutomatic
End If
Next
Application.ScreenUpdating = True
End Sub
The code just removes all text for some reason! I also recorded a macro to see what the original font was that I need to change but I can't get it to work. Can someone please help me? My brain is starting to hurt now... Thanks! Paul, Ireland
Range("D30:G30").Select
With Selection.Font
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
End With