VBA & Macro Problems

How to Automatically Clear a Cell in WPS Office Spreadsheets When a Part Moves

Phi Hung VoPhi Hung Vo Nov 13, 2026 868 views

Question details

The user wants to clear a shelf or location value automatically when a part is assigned to a technician.

How to Automatically Clear a Cell in WPS Office Spreadsheets When a Part Moves
Product
WPS Office Spreadsheets
Device & OS
not provided
Scenario
The user tracks parts in a spreadsheet and needs the shelf or location cell to become empty once a technician name is entered in another column.
Observed behavior
A formula in the same cell cannot clear its own original value without creating a circular reference, so the original shelf value must be stored separately or cleared with VBA.
Before you start

If you plan to use the VBA method, save the workbook as an Excel Macro-Enabled Workbook (.xlsm) and make sure the Developer tab is available in WPS Spreadsheets.

Solution 1Recommended

Clear Column B Automatically with a Worksheet Change Macro in WPS Spreadsheets

Use this solution when you need the original shelf or location cell to be cleared immediately after a technician name is entered in column A.

A formula cannot clear the original value in its own cell because that creates a circular reference. This worksheet-change macro bypasses that limitation by clearing the adjacent shelf/location cell after a change in column A.

1
Open the VBA editor

In WPS Spreadsheets, click the Developer tab and then click Macros, or press Alt+F11 to open the VBA editor.

2
Open the target worksheet module

In the VBA editor Project pane, double-click the worksheet that contains column A and column B so its code window opens.

3
Paste the worksheet-change VBA code

Paste the following code into the worksheet module: Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Target, Range("A:A")) Is Nothing Then If Target.Value = "TECHS NAME" Then Target.Offset(0, 1).ClearContents End If End If End Sub

4
Save as a macro-enabled workbook

Go to File > Save As, choose Excel Macro-Enabled Workbook (*.xlsm), and click Save.

5
Test the automation

Type the technician name in column A and verify that the adjacent column B cell is cleared automatically.

Clear Column B Automatically with a Worksheet Change Macro in WPS Spreadsheets
Automation enabled: After saving as .xlsm and enabling macros, the sheet clears column B whenever a technician name is entered in column A.

Automate Cell Clearing in WPS Spreadsheets

You can complete this automation directly in WPS Spreadsheets by using a worksheet-change macro or a helper formula, without leaving the familiar Excel-compatible workflow.

  1. 1. Open your workbook in WPS Spreadsheets: Launch WPS Office, click Open, and select your Excel or macro-enabled workbook.
  2. 2. Enable the Developer tab if needed: Click the Menu button, go to Options, show the Developer tab in the ribbon, and return to the spreadsheet.
  3. 3. Create the worksheet-change macro: On the Developer tab, click Macros or press Alt+F11, paste the worksheet-change code into the target sheet module, and save as .xlsm.
  4. 4. Test the automation: Type the technician name in column A and confirm the adjacent shelf cell clears automatically.
Create automated cell clearing with the built-in macro editor in WPS Spreadsheets.Open, edit, and save Excel-compatible .xlsm macro-enabled workbooks.Free, lightweight Office suite with a familiar ribbon interface.Maintains Excel formulas and formatting for seamless migration.
microsoft office alternative - wps office

Frequently Asked Questions

Can a formula clear the original shelf cell by itself?

No. A formula cannot change the value of its own cell without creating a circular reference. Store the source value in a separate column and use a helper formula, or clear column B with a VBA worksheet-change macro.

Why is my VBA macro not running in WPS Spreadsheets?

Make sure the workbook is saved as an Excel Macro-Enabled Workbook (.xlsm), macros are enabled in WPS Office security settings, and the worksheet-change code is pasted into the target worksheet module rather than a standard module.

Can I clear the cell based on any technician name instead of one specific name?

Yes. Change the macro condition to check for any non-empty value in column A, for example: If Target.Value <> "" Then Target.Offset(0, 1).ClearContents.

Does this work for an entire column?

Yes. The worksheet-change macro monitors column A with Intersect and clears the adjacent cell in column B for any monitored row. The helper formula can also be dragged down through the needed rows.

How do I preserve the original shelf value after it is cleared?

Store the original value in another column or a hidden sheet before clearing it, or use a helper display column instead of clearing the source cell.