Announcement

Collapse
No announcement yet.

Automatically formatting a cell based other cells format.

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Automatically formatting a cell based other cells format.



    G'day.

    I've been trying to figure out how to make a cell's format match another cell if the format changes.

    Say I have a cell which I might occasionally format White font, Red fill. Now, I have another cell on a different worksheet that mirrors the data in this cell, but not the format. How do I get this cell to mirror the format too ?

    Cheers

  • #2
    Re: Automatically formatting a cell based other cells format.

    hi nodnerb

    see perhaps this code can help you

    Code:
    Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Sheets("sheet2").Range("C4")) Is Nothing Then
    If Target.Value = Sheets("sheet1").Range("C9").Value Then
    Target.Interior.ColorIndex = Sheets("sheet1").Range("C9").Interior.ColorIndex
    Target.Font.ColorIndex = Sheets("sheet1").Range("C9").Font.ColorIndex
    Else
    Target.Interior.ColorIndex = xlNone
    Target.Font.ColorIndex = xlAutomatic
    End If
    End If
    End Sub
    pangolin

    Comment


    • #3


      Re: Automatically formatting a cell based other cells format.

      Thanks pangolin.

      I'll give it a shot.

      btw, do I need to edit that VBA to look at specific cells ?

      Say Sheet1!D7 is formatted, and I want to mirror the format to Sheet9!D5, how would that change that code ?

      Cheers

      Comment

      Working...
      X