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

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
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
 
Upvote 0

Forum statistics

Threads
1,214,976
Messages
6,122,541
Members
449,089
Latest member
davidcom

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