Results 1 to 8 of 8

"If" and Syntax to change font and fill (interior) color based on cell value

Threaded View

  1. #1
    Registered User
    Join Date
    01-12-2012
    Location
    Rockland, WI
    MS-Off Ver
    Excel 2016
    Posts
    56

    "If" and Syntax to change font and fill (interior) color based on cell value

    How do I structure my If statement to change the font and fill color if the cell value is between -500 and 500? I have the following code which works with debug.print where I would like to change the font and fill colors.

    ThisWorkbook.Worksheets("lastmaintenance").Range("M1").Select
        
        nOffSetRow = 1
        
        Do Until ThisWorkbook.Worksheets("lastmaintenance"). _
        Range("M1").Offset(nOffSetRow).Value = ""
        
           MileageSvcDo = CInt(ThisWorkbook.Worksheets("lastmaintenance"). _
           Range("M1").Offset(nOffSetRow).Value)
           
           'what is the syntax to
           'change the font(to color -16383844)
           'and fill color (to color 13551615)
           'if the value of MileageSvcDo
           'is > -500 And < 500
           
           End If
               
        nOffSetRow = nOffSetRow + 1
        
        Loop
    Last edited by jdfjab; 02-17-2012 at 12:24 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1