Thank you for taking time to read this
I am wotking with a tutorial first time using VBA
At the moment it works when All the text in the row has red font - I need it so that
1. It only selects the cells with red font and copy those only NOT the entire row and also put the cell in same position on the new sheet it copies to.
2. Also copy into new sheet the code value in the row Col A see mockup image
I am wotking with a tutorial first time using VBA
At the moment it works when All the text in the row has red font - I need it so that
1. It only selects the cells with red font and copy those only NOT the entire row and also put the cell in same position on the new sheet it copies to.
2. Also copy into new sheet the code value in the row Col A see mockup image
VBA Code:
Sub CopyColouredFontTransactions()
Dim TransIDField As Range
Dim TransIDCell As Range
Dim ATransWS As Worksheet
Dim HTransWS As Worksheet
Dim x As Long
Set ATransWS = Worksheets("All Transactions")
Set TransIDField = ATransWS.Range("A2", ATransWS.Range("A2").End(xlDown))
Set HTransWS = Worksheets("Highlighted Transactions")
For Each TransIDCell In TransIDField
If TransIDCell.Font.Color = RGB(255, 0, 0) Then
TransIDCell.Resize(1, 10).Copy Destination:= _
HTransWS.Range("A1").Offset(HTransWS.Rows.Count - 1, 0).End(xlUp).Offset(1, 0)
End If
Next TransIDCell
HTransWS.Columns.AutoFit
End Sub