Deleting cell data upon open based on cell value

Darren_workforce

Board Regular
Joined
Oct 13, 2022
Messages
128
Office Version
  1. 365
Platform
  1. Windows
Hello,

I have 12 tabs (Jan, Feb, Mar, Apr...) and anytime the file is opened, I would like to have specific cell values deleted using VBA. I have the code below which works for the range but how should it be adjusted to find and delete specific cell data? In all, I would like all ones, zeroes, bereavement and training removed upon opening the file.

VBA Code:
Private Sub Workbook_Open()
    Application.EnableEvents = False
        Worksheets("test").Range("A1:A11").Value = ""
    Application.EnableEvents = True
End Sub

Thank you in advance for assistance!!
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Sorry I forgot to add previously: the worksheet is a shared data connection with another file so anytime the refresh is performed, the removed cell data CANNOT return.
 
Upvote 0
Sorry I forgot to add previously: the worksheet is a shared data connection with another file so anytime the refresh is performed, the removed cell data CANNOT return.
I believe I have the macro for the clear contents when the file opens. However, since it is a data connection and set to refresh periodically, it pulls the data up after the refresh and does not continually clear the requested contents. Is there a workaround for the refresh?
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,959
Members
449,096
Latest member
Anshu121

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top