sitelbanat
Board Regular
- Joined
- Oct 17, 2005
- Messages
- 152
how would I add to this macro, so it would color the cells blue after putting them in the desired column?
Selection.Interior.ColorIndex = 33
[
Sub Rectangle221_Click()
Dim i As Long
'find the column# where the date is
With Rows(2)
Set c = .Find(Range("aj116").Value, , , xlWhole)
If Not c Is Nothing Then
rfnd = c.Column
End If
End With
'find the match currencies of all the records from aj117 to last row
'and put the values in desired date column
For i = 117 To Range("af" & Rows.Count).End(xlUp).Row
With Columns("b")
Set fc = .Find(Cells(i, "af").Value, , , xlWhole)
If Not fc Is Nothing Then
On Error GoTo err:
Cells(fc.Row, rfnd).Value = Cells(i, "ag").Value
End If
End With
Next
'if no date found from row 2
err:
End Sub
][/code]
Selection.Interior.ColorIndex = 33
[
Sub Rectangle221_Click()
Dim i As Long
'find the column# where the date is
With Rows(2)
Set c = .Find(Range("aj116").Value, , , xlWhole)
If Not c Is Nothing Then
rfnd = c.Column
End If
End With
'find the match currencies of all the records from aj117 to last row
'and put the values in desired date column
For i = 117 To Range("af" & Rows.Count).End(xlUp).Row
With Columns("b")
Set fc = .Find(Cells(i, "af").Value, , , xlWhole)
If Not fc Is Nothing Then
On Error GoTo err:
Cells(fc.Row, rfnd).Value = Cells(i, "ag").Value
End If
End With
Next
'if no date found from row 2
err:
End Sub
][/code]