1. Article / Tutorial
  2. Outline

A visually consistent and appealing report not only communicates information more effectively but also reflects a high level of professionalism. This macro simplifies the process of applying a cohesive formatting style to your spreadsheet, covering font size, cell color, and borders, ensuring that your reports stand out for all the right reasons.

Description

The Quick Formatting macro automates the following tasks to enhance the visual appeal of your spreadsheet:

  • Font Size Adjustment: Ensures that the text is of a uniform and readable size.
  • Cell Color Application: Applies a background color to cells for easy differentiation of sections or for highlighting important data.
  • Border Addition: Outlines cells or ranges to define data areas clearly and enhance readability.

Use Case

This macro is invaluable for anyone looking to ensure consistency in the presentation of their reports. Whether you’re preparing financial statements, project plans, or performance analyses, Quick Formatting can significantly reduce the time spent on manual formatting and ensure that each report maintains a standard visual style.

Example Spreadsheet Data

Imagine a spreadsheet containing quarterly sales data before formatting:

Quarter Sales ($) % Change
Q1 25,000 5%
Q2 27,500 10%
Q3 30,250 10%
Q4 33,275 10%

Objective: Apply a standard format to enhance the readability and presentation of the data.

Code Snippet

Microsoft Excel (VBA):

Sub QuickFormat()
    With ActiveSheet.Range("A1:C5")
        ' Apply font size
        .Font.Size = 12
        
        ' Apply cell color
        .Rows(1).Interior.Color = RGB(220, 230, 241) ' Light blue header
        .Rows("2:5").Interior.Color = RGB(235, 241, 222) ' Light green data rows
        
        ' Apply borders
        With .Borders
            .LineStyle = xlContinuous
            .Color = RGB(0, 0, 0)
            .Weight = xlThin
        End With
    End With
End Sub

Google Sheets (Google Apps Script):

function quickFormat() {
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  var range = sheet.getRange("A1:C5");
  
  // Apply font size
  range.setFontSize(12);
  
  // Apply cell color
  range.getRow(1).setBackground("#DCE6F1"); // Light blue header
  range.getRows("2:5").setBackground("#EBF1DE"); // Light green data rows
  
  // Apply borders
  range.setBorder(true, true, true, true, true, true, "#000000", SpreadsheetApp.BorderStyle.SOLID);
}

After running this macro, your spreadsheet will transform into a neatly formatted report:

Quarter Sales ($) % Change
Q1 25,000 5%
Q2 27,500 10%
Q3 30,250 10%
Q4 33,275 10%

The headers are highlighted in light blue, data rows in light green, and everything is neatly bordered, making the report visually appealing and easier to read. This demonstrates how Quick Formatting can elevate the presentation of your data with minimal effort.

Macro 2: Quick Formatting

  • Description: Streamlines the task of applying a standard format to cells, including font size, cell color, and borders.
  • Use Case: Ensures consistent presentation of reports.
  • Code Snippet: VBA/Google Apps Script example.

All text and images are Copyright © Office Spreadsheets

User privacy is important and is detailed in our Privacy Policy.

See our Cookie Policy for how we use cookies and user options.

See also Office Spreadsheets Terms of Service.