Avatar of BostonBob
BostonBob
 asked on

Reset a Range

Hi All,

I am trying to do a "reset" every time I open a workbook.  Specifically I would like the worksheet ("BegDay") to do the following in the range J10:J1000

'Place the number 1,000,000 in each and every cell of the range of J10:J1000
'Then immediately place "" in each and every cell of the range of J10:J1000


This should happen every single time the work book opens.

Any ideas?

thanks,
Microsoft OfficeMicrosoft Excel

Avatar of undefined
Last Comment
BostonBob

8/22/2022 - Mon
byundt

I'm a little confused by why you first want to set all the cells in the specified range to 1,000,000 and then to "".

Nevertheless, the following macro does that. Note that statements 3 and 4 in the snippet below are two alternative ways of clearing the values in J10J1000. The first one puts two double quotes in those cells. The second removes all values.

Put the following code in ThisWorkbook code pane. It won't work at all if installed anywhere else.
Private Sub Workbook_Open()
Worksheets("BegDay").Range("J10:J1000").Value = 1000000
Worksheets("BegDay").Range("J10:J1000").Value = """"        'What you asked for
'Worksheets("BegDay").Range("J10:J1000").ClearContents       'What I think you need instead
End Sub

Open in new window

BostonBob

ASKER
Thanks for that byundt.

Not quite what I need.  I am doing a "persistent max and min" function and need this to be a tweaked a bit more.

I put your code above in it didn't work.

I think what I need is for:

Worksheets("BegDay").Range("J10:J1000").Value = 1000000

....to fill down the range first....and then for....

Worksheets("BegDay").Range("J10:J1000").ClearContents

....to fill down the range after each cell has a 1000000 in it.  Maybe this can be accomplished by a 15 second delay?  

thoughts?

thanks,
ASKER CERTIFIED SOLUTION
byundt

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
BostonBob

ASKER
Precisely Perfect!!!  Thanks so much and Happy New Year!!!
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
BostonBob

ASKER
Just Awesome!