VBA help on conditional formatting.

imback2nite

Board Regular
Joined
Oct 30, 2004
Messages
211
Office Version
  1. 2003 or older
Platform
  1. Windows
I was wondering if it was possible to be able to bold and italicize a name from a drop down box. I have a list of names on worksheet 3 that will get longer and shorter. I’ve named the range, Pro. Named Range =OFFSET(Pro!$G$1,0,0,COUNTA(Pro!$G:$G)).
On worksheet 4 I have a grid with drop down boxes. What I would like to happen is if I select a name from worksheet 3 on worksheet 4, it will bold and italicize. This grid will be from A20 to approximately BB70. I will also be using this code below on worksheet 4. I’m using Excel 2003 so I’m not able to use a lot of the new features. Thank you for any help as I’ve been scouring the pages for what I thought would work but..well thanks for any help.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)

Dim Cell As Range
Dim Rng1 As Range

 On Error Resume Next
    Set Rng1 = ActiveSheet.Cells.SpecialCells(xlCellTypeFormulas, 1)
    On Error GoTo 0
    If Rng1 Is Nothing Then
        Set Rng1 = Range(Target.Address)
    Else
        Set Rng1 = Union(Range(Target.Address), Rng1)
    End If
    For Each Cell In Rng1
        
        If Cell.Value = vbNullString Then
            Cell.Resize(, 2).Interior.ColorIndex = xlNone
            Cell.Resize(, 2).Font.Bold = False
        ElseIf UCase(Cell.Value) Like UCase(Sheet5.Range("K2") & "*") Then
            Cell.Resize(, 2).Interior.ColorIndex = 6
        ElseIf UCase(ActiveCell.Offset(0, -1).Value) Like UCase(Sheet5.Range("K2") & "*") Then
            Cell.Interior.ColorIndex = 6
        ElseIf UCase(Cell.Value) Like UCase(Sheet5.Range("K3") & "*") Then
            Cell.Resize(, 2).Interior.ColorIndex = 8
        ElseIf UCase(ActiveCell.Offset(0, -1).Value) Like UCase(Sheet5.Range("K3") & "*") Then
            Cell.Interior.ColorIndex = 8
        Else
            Cell.Interior.ColorIndex = xlNone
            Cell.Font.Bold = False
        End If
    Next
End Sub
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top