-
Excel VBA: Format and change cell value based on specific values in cell
I would like the below to change the value of the particular cell to "Rank" if two consecutive cells in the column are "#Name"
In addition, it would be helpful if the formatting of the cell could be red and font color white, while the value in the preceding cell would be nothing, and color blue
This is what I wrote but it isn't working, really appreciate guidance-
Sub FormatRankColmn()
'
' FormatRankColmn Macro
'
'
Dim cell As Range
ForEach cell In Range("D1:250").SpecialCells(xlCellTypeConstants)
If cell.Offset(-1,0).Value ="#NAME"Then
If cell.Value ="#Name"Then
Range(cell).Value ="Rank"
EndIf
EndIf
Next
EndSub
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules