VBA & Macro Problems

Update the Same Range or Table on Multiple Excel Worksheets

Natalie TaylorNatalie Taylor Nov 18, 2026 868 views

Question details

Update the same range or table column across many Excel worksheets using a VBA macro.

How to Update the Same Range or Table on Multiple Excel Worksheets
Product
Microsoft Excel
Device & OS
not provided
Scenario
A workbook contains hundreds of worksheets that need the same value or formula, with some sheets potentially excluded.
Observed behavior
The user wants to apply a consistent update to the intended worksheets without editing each sheet individually.
Before you start

Identify the sheets to exclude, the target cell or table column, and whether the update is a value or formula. Save a test copy as an Excel Macro-Enabled Workbook (.xlsm) and confirm that macros are permitted.

Solution 1Recommended

Update the Same Cell or Range on Each Worksheet

Use this VBA macro when the target is an ordinary worksheet range at the same address on each included sheet.

1
Open the VBA editor

Open the test workbook in desktop Excel, then select Developer > Visual Basic or press Alt+F11 where available.

2
Insert the macro

In the VBA editor, select the test workbook and choose Insert > Module. Paste this code: Sub UpdateRanges() Dim ws As Worksheet For Each ws In ThisWorkbook.Worksheets If StrComp(ws.Name, "Summary", vbTextCompare) <> 0 Then ws.Range("B17").Value = 2023 ' For a formula instead, replace the line above with: ' ws.Range("B17").Formula = "=A17*2" End If Next ws End Sub

3
Adjust the targets

In the code, replace Summary with the sheet to exclude and B17 with the target cell or range. Set the value after .Value, or replace that line with the .Formula line and edit the formula.

4
Test and run the macro

Return to Excel, select Developer > Macros, choose UpdateRanges, and select Run. Check several included sheets and the excluded sheet before using the macro on the intended workbook.

Update the Same Cell or Range on Each Worksheet
Workbook scope: ThisWorkbook refers to the workbook containing the macro. Add further exclusion conditions if more sheets must be skipped; the example excludes only Summary.
Free Microsoft Office alternative

Work with Excel Spreadsheets in WPS Office

WPS Office is a free, lightweight alternative with a familiar spreadsheet interface for opening and editing Excel workbooks. It does not fix Excel VBA issues, so verify macro compatibility before migrating a macro-enabled workbook.

Open and edit Excel-compatible XLSX and XLS filesReview worksheet ranges and tables in a familiar spreadsheet interfaceMove existing spreadsheets into WPS Office without starting from scratchUse a free, lightweight office suite for everyday spreadsheet work
microsoft office alternative - wps office

Frequently Asked Questions

How do I exclude more than one worksheet?

Add another condition to the macro's If statement, such as And StrComp(ws.Name, "Instructions", vbTextCompare) <> 0. Test the exclusions before running the macro across the workbook.

How do I write a formula instead of a value?

Replace the target's .Value assignment with a .Formula assignment, such as ws.Range("B17").Formula = "=A17*2". Check the results on several sheets before applying it broadly.

Why did the table macro skip a worksheet?

The example skips a sheet if it has no table, if its first table lacks the Status column, or if that column has no data rows. Check the table order and column name on the skipped sheet.

Can I run the macro in an ordinary XLSX workbook?

Save the workbook containing the VBA code as an Excel Macro-Enabled Workbook (.xlsm) using File > Save As. An XLSX file cannot retain VBA macros.