Results 1 to 5 of 5

Thread: Need Help in VBA

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Newbie
    Joined
    Jan 2019
    Posts
    3
    Location

    Need Help in VBA

    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.
    Last edited by Paul_Hossler; 01-30-2019 at 07:35 AM.

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
  •