+ Reply to Thread
Results 1 to 4 of 4

IF Statement For Conditional "Bolding"

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    10-03-2012
    Location
    CDN
    MS-Off Ver
    Excel 2007
    Posts
    135

    IF Statement For Conditional "Bolding"

    Hi All,

    I have two columns with data, A and B.

    What kind of IF statement is needed to say that if the cell is blank in column B, make the adjacent cell in column A bold?

    I imagine it would need to be within something like this:
    With Me.Range("A" & LR + 2)
       
       
    End With
    Can anyone help me out?
    Last edited by Jrub; 10-26-2012 at 12:25 PM.

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: IF Statement For Conditional "Bolding"

    Hi, Jrub,

    maybe like this:
    With Range("A" & LR + 2)
       If IsEmpty(.Offset(0, 1).Value) Then
          .Font.Bold = True
       End If
    End With
    If the cells in Column B are really empty (blanks, no formulas) you could try something like this:
    Dim rngCell As Range
    
    On Error Resume Next
    For Each rngCell In Range("B2:B" & Cells(Rows.Count, "B").End(xlUp).Row).SpecialCells(xlCellTypeBlanks)
      rngCell.Offset(0, -1).Font.Bold = True
    Next rngCell
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Forum Contributor
    Join Date
    10-03-2012
    Location
    CDN
    MS-Off Ver
    Excel 2007
    Posts
    135

    Re: IF Statement For Conditional "Bolding"

    Holger,

    Thanks alot, much appreciated.

    The first code didn't work, so I tried the following and it worked great!
     With Range("A" & LR + 2)
        On Error Resume Next
        For Each rngCell In Range("B2:B" & Cells(Rows.Count, "B").End(xlUp).Row).SpecialCells(xlCellTypeBlanks)
        rngCell.Offset(0, -1).Font.Bold = True
        Next rngCell
    End With
    Thanks again!

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: IF Statement For Conditional "Bolding"

    Hi, Jrub,

    your With statement isnīt referred to in the code so it may be omitted (the code within refers to all cells in column B`s filled range).

    Glad I could be of help.
    Holger

+ Reply to Thread

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