estatefinds
08-09-2018, 04:40 PM
Function GetColorText(pRange As Range) As String 'Updateby20141105
Dim xOut As String
Dim xValue As String
Dim i As Long
xValue = pRange.Text
For i = 1 To VBA.Len(xValue)
If pRange.Characters(i, 1).Font.Color = vbRed Then
xOut = xOut & VBA.Mid(xValue, i, 1)
End If
Next
GetColorText = xOut
End Function
I attached a file that shows data that is colored interior red and other data no interior color. I need the existing code to work with interior color of cell instead of the Font color.
For eample I want to be able to run macro that would remove the data colored in red from the range A22 to E22 and move them from rows to Column, column J starting at row 22; leaving the remaining uncolored data alone.
Any help on this is greatly appreciated.
Sincerely Dennis
Dim xOut As String
Dim xValue As String
Dim i As Long
xValue = pRange.Text
For i = 1 To VBA.Len(xValue)
If pRange.Characters(i, 1).Font.Color = vbRed Then
xOut = xOut & VBA.Mid(xValue, i, 1)
End If
Next
GetColorText = xOut
End Function
I attached a file that shows data that is colored interior red and other data no interior color. I need the existing code to work with interior color of cell instead of the Font color.
For eample I want to be able to run macro that would remove the data colored in red from the range A22 to E22 and move them from rows to Column, column J starting at row 22; leaving the remaining uncolored data alone.
Any help on this is greatly appreciated.
Sincerely Dennis