• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Shading Color on cell based

Prakash M

New Member
Hi,
Please refer to the attached sheet - -
I'm looking for coloring the cell based on another cell (only coloring - no text or inputs into a cell).

Suppose if I manually fill color with RED for cell G2 in Sheet1, the same color should automatically get applied for G2 in Sheet2.
Or if I color F6 with YELLOW as per Request ID - 1248 in column A, against the same Request ID the same YELLOW color should get applied.

Please help me with any of the If Formulas or VBA coding. If the same post is already been posted , please share me the link.

Thanks,
Prakash
 

Attachments

  • Rough Data.xlsx
    11 KB · Views: 0
Prakash,

Without knowing the specifics of your application, I would suggest that you don't need a formula or VBA.

Instead, I would do it this way:

Before making a manual color change, hold down CTRL and select all the sheets (at the bottom of the window) that you want the color change to be applied to.

In your example, I would hold down CTRL and select Sheet1 and Sheet2. Then go to Cell G2 and manually fill with RED.

Next, right click the sheet name at the bottom and Ungroup Sheets.

The formatting change will apply to cell G2 on all the sheets you had selected.
 
Assuming that the data in Sheet1 & Sheet 2 is exactly the same, i.e. Same rows have same data for same RequestID. The below code should work.

Code:
Sub colourmycells()

Dim MyTBL As String

'Copy format from Sheet1
'-----------------------
Worksheets("Sheet1").Select
Range("A2:K" & Cells(Rows.Count, "A").End(xlUp).Row).Select
MyTBL = Selection.Address
Selection.Copy
Range("A1").Select

'Paste format to Sheet2
'----------------------
Worksheets("Sheet2").Select
Range(MyTBL).Select
Selection.PasteSpecial xlPasteFormats
Application.CutCopyMode = False
Range("A1").Select

End Sub
 
Back
Top