A friend wanted help to write a macro to change the text colour (to turn blue text to black and red text to blue) I thought I could help and so made this:
Sub changecol()
For Each Cell In Selection
If Cell.Font.ColorIndex = 37 Then
Cell.Font.ColorIndex = 1
End If
Next
For Each Cell In Selection
If Cell.Font.ColorIndex = 3 Then
Cell.Font.ColorIndex = 37
End If
Next
End Sub
I then found out that his cells had multiple font colours within in them (blue, black and red) and only part of the cell text should be changed.
This is much more complicated. I was wondering whether there is a way to use the cell.characters.font property to count the starting character number and length of say the blue text in order to convert it to black.
Would this even be possible?
Any thoughts greatly appreciated!
Thanks,
James
Sub changecol()
For Each Cell In Selection
If Cell.Font.ColorIndex = 37 Then
Cell.Font.ColorIndex = 1
End If
Next
For Each Cell In Selection
If Cell.Font.ColorIndex = 3 Then
Cell.Font.ColorIndex = 37
End If
Next
End Sub
I then found out that his cells had multiple font colours within in them (blue, black and red) and only part of the cell text should be changed.
This is much more complicated. I was wondering whether there is a way to use the cell.characters.font property to count the starting character number and length of say the blue text in order to convert it to black.
Would this even be possible?
Any thoughts greatly appreciated!
Thanks,
James