LalithaG
01-29-2019, 08:51 PM
Hi everyone!
I have the requirement of changing the font color of one range of values depending on another range of values. Below is my code. But it is not working effectively. Can anyone help me what is wrong with it?
Thanks a lot in advance :)
l
row = Range("C6").End(xlToRight).Column /This is to know the last column
Set rng = Range("C7:" & Cells(15, lrow).Address(RowAbsolute:=False, columnabsolute:=False)) /The range starts from C7
Set rng1 = Range("C37:" & Cells(45, lrow).Address(RowAbsolute:=False, columnabsolute:=False)) /Ends at 37th row but the column is whatever "lrow" has
Workbooks(sheet.Range("C4").Value).Activate
Sheets("Sheet1").Activate
For Each Item In rng1
If Item < 30 Then
rng1(Item).Font.Color = RGB(255, 0, 0)
rng(Item).Font.Color = RGB(255, 0, 0)
End If
Next Item
The requirement is if any value < 30 in one range then this value & the other range corresponding value's font color should be changed to red.
Hope it is clear.
I have the requirement of changing the font color of one range of values depending on another range of values. Below is my code. But it is not working effectively. Can anyone help me what is wrong with it?
Thanks a lot in advance :)
l
row = Range("C6").End(xlToRight).Column /This is to know the last column
Set rng = Range("C7:" & Cells(15, lrow).Address(RowAbsolute:=False, columnabsolute:=False)) /The range starts from C7
Set rng1 = Range("C37:" & Cells(45, lrow).Address(RowAbsolute:=False, columnabsolute:=False)) /Ends at 37th row but the column is whatever "lrow" has
Workbooks(sheet.Range("C4").Value).Activate
Sheets("Sheet1").Activate
For Each Item In rng1
If Item < 30 Then
rng1(Item).Font.Color = RGB(255, 0, 0)
rng(Item).Font.Color = RGB(255, 0, 0)
End If
Next Item
The requirement is if any value < 30 in one range then this value & the other range corresponding value's font color should be changed to red.
Hope it is clear.