View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Cut/paste cells based on text color or certain characters

The following looks at column A. If it finds cells with red font, it moves
the contents to column B:

Sub berrier()
Dim r As Range
Set r = Nothing
n = 100
For i = 1 To n
If Cells(i, "A").Font.ColorIndex = 3 Then
If r Is Nothing Then
Set r = Cells(i, "A")
Else
Set r = Union(r, Cells(i, "A"))
End If
End If
Next

r.Offset(0, 1) = r.Value
r.Clear
End Sub

I did not check the () as they may be only in the formatting.
--
Gary's Student
gsnu200703


"michaelberrier" wrote:

In a bank export spreadsheet, transaction amounts are listed in a
single column and are separated into credits and debits by color and
parenthesis (credit=black, debit=(red)).

I would like to run a sub to move all the debits into the next column,
and I'm guessing the best way to do this is by using and IF statement
that depends on the presence of red text or the parenthesis.

Any help on the routine will be appreciated.