Forum Discussion

ZachZ1290's avatar
ZachZ1290
Copper Contributor
Jul 26, 2024

Keeping formatting on frozen columns across sheets?

Hello,

I've got the first three columns on sheet one formatted conditionally, and frozen. They are always the leading three columns on all following sheets in the workbook, and continue the color pattern, for example when I type "Conservation" in an empty cell in column B, it turns orange.

My intent, which I cannot figure out, is to be able to update the data in sheet one in these frozen columns, and have it update across all sheets, while keeping the source formatting; cell fill color, bold, and links. I've tried copy->paste as link for the column on the next sheets, but that doesn't keep the formatting. I've also tried a few formulas that replicate the data accurately, but don't keep the color coding, or the corresponding hyperlinks, for example.

Seems like this function should be hiding in plain sight, but I'm somewhat of an Excel newbie here, so please keep that in mind, if you're kind enough to respond.

Thank you!

1 Reply

  • NikolinoDE's avatar
    NikolinoDE
    Gold Contributor

    ZachZ1290 

    To achieve the goal of updating the data in the first three columns on Sheet1 and having those updates reflect across all sheets, while maintaining the formatting (cell fill color, bold, links, etc.), you will need to use a combination of Excel features. Here is a step-by-step approach:

    1. Create a Template Sheet:
      • Format the first three columns on Sheet1 as desired (conditional formatting, cell fill color, bold, hyperlinks, etc.).
      • Name this sheet something like "Template".
    2. Copy Formatting to Other Sheets:
      • Select the first three columns of the Template sheet.
      • Right-click and choose "Copy".
      • Go to each of the other sheets, select the first three columns, right-click and choose "Paste Special" > "Formats".
    3. Link Data Across Sheets:
      • In the first cell of the first column on Sheet2, enter a formula to link to the corresponding cell on the Template sheet, e.g., =Template!A1.
      • Drag this formula across the first three columns and down as needed.
      • Repeat this process for each sheet.

    Detailed Steps:

    Step 1: Create a Template Sheet

    • Format the first three columns in the "Template" sheet with the desired conditional formatting, cell fill colors, bold text, and hyperlinks.

    Step 2: Copy Formatting

    • Select the first three columns (A, B, and C) in the Template sheet.
    • Right-click and choose "Copy" (or use Ctrl+C).
    • Go to each of the other sheets, select the first three columns, right-click, and choose "Paste Special" > "Formats".

    Step 3: Link Data

    • Go to Sheet2.
    • In cell A1, enter the formula =Template!A1.
    • Drag the fill handle (a small square at the bottom-right corner of the cell) across to column C and down to fill the range as needed.
    • Repeat this for all sheets.

    VBA Solution (Optional)

    For a more automated solution, you can use a VBA macro. Here’s a sample macro that copies the first three columns from the Template sheet to all other sheets while preserving the formatting:

    The VBA code is untested and serves as an example only, please backup your file in advance as a precaution.

    Sub CopyTemplateColumns()
        Dim ws As Worksheet
        Dim templateSheet As Worksheet
        Set templateSheet = ThisWorkbook.Sheets("Template")
        
        ' Loop through all sheets in the workbook
        For Each ws In ThisWorkbook.Sheets
            ' Skip the Template sheet
            If ws.Name <> templateSheet.Name Then
                ' Copy data and formatting from Template sheet
                templateSheet.Range("A:C").Copy
                ws.Range("A:C").PasteSpecial Paste:=xlPasteFormats
                ws.Range("A:C").PasteSpecial Paste:=xlPasteValues
            End If
        Next ws
        
        ' Clear the clipboard
        Application.CutCopyMode = False
    End Sub

    To use the macro:

    1. Press Alt + F11 to open the VBA editor.
    2. Insert a new module: Insert > Module.
    3. Copy and paste the above VBA code into the module.
    4. Press F5 to run the macro.

    This macro will copy both the data and the formatting from the first three columns of the "Template" sheet to all other sheets in the workbook.

    By following these steps, you will ensure that the first three columns on all sheets in your workbook are updated and formatted consistently, based on the content and formatting in the Template sheet.

    NOTE: Since no one has answered it for at least one day or more, I entered your question in an AI. The text and the steps are the result of AI. Maybe it will help you further in your project, if not please just ignore it.

    My answers are voluntary and without guarantee!

     

    Hope this will help you.

    Was the answer useful? Mark as best response and Like it!

    This will help all forum participants.

Resources