Conditional Formatting Based on List

poleary2000

Active Member
Joined
Apr 1, 2002
Messages
354
Good afternoon,

I have two sheets. One with many inputs, and one with a listing of unique inputs. The unique inputs, I have formatted the way I want to look on the other sheet. Is there a way to conditionally format the inputs page with the formate on the unique inputs page based on what is entered into a cell?

I know I can do this with Conditional Formatting, but I don't want to create 30 rules. I want to create one rule that checks for the value in the list and if found, applies the format found in that cell. Is that possible without VBA? If so, great. If not, could you help with code that changes based on the cell value?
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

poleary2000

Active Member
Joined
Apr 1, 2002
Messages
354
Good afternoon,

I have two sheets. One with many inputs, and one with a listing of unique inputs. The unique inputs, I have formatted the way I want to look on the other sheet. Is there a way to conditionally format the inputs page with the formate on the unique inputs page based on what is entered into a cell?

I know I can do this with Conditional Formatting, but I don't want to create 30 rules. I want to create one rule that checks for the value in the list and if found, applies the format found in that cell. Is that possible without VBA? If so, great. If not, could you help with code that changes based on the cell value?
I ended up doing this...

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim KeyCells As Range


    ' The variable KeyCells contains the cells that will
    ' cause an alert when they are changed.
    Set KeyCells = Range("C5:XFD17")
    
    If Not Application.Intersect(KeyCells, Range(Target.Address)) Is Nothing Then
           
           FindCell = Target.Value
           
           With Sheets("Inputs").Range("A:A")
              
                    'If you want to find a part of the rng.value then use xlPart
                    'if you use LookIn:=xlValues it will also work with a
                    'formula cell that evaluates to MySearch(I)
                    Set Rng = .Find(What:=FindCell, _
                            After:=.Cells(.Cells.Count), _
                            LookIn:=xlValues, _
                            LookAt:=xlWhole, _
                            SearchOrder:=xlByColumns, _
                            SearchDirection:=xlNext, _
                            MatchCase:=False)
        
                    If Not Rng Is Nothing Then
                        FirstAddress = Rng.Address
                        Do
                            Target.Interior.ColorIndex = Rng.Interior.ColorIndex
                            Target.Font.ColorIndex = Rng.Font.ColorIndex
                            


                        Loop While Not Rng Is Nothing And Rng.Address <> FirstAddress
                    End If


            End With
       
    End If
End Sub
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,670
Messages
5,838,689
Members
430,564
Latest member
Raeyven

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
Top