Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

1
VBA Script on Workbook Open to add formula only when cell does not contain specific words
Post Flair (click to view more posts with a particular flair)
Post Body

Hello all! I have a workbook containing the following code in Private Sub Workbook_Open():

Range("Training!N2:N200").Formula = "=IF(E2="""","""",WORKDAY(E2,3,Data!$B$5:$B$25))"

Range("Training!O2:O200").Formula = "=IF(E2="""","""",WORKDAY(E2,5,Data!$B$5:$B$25))"

Range("Training!P2:P200").Formula = "=IF(E2="""","""",WORKDAY(E2,10,Data!$B$5:$B$25))"

So as most of you will figure out, it simply adds a formula to calculate a date in the cell every time I open the workbook. My issue is that when modifying the workbook, sometimes I purposely override the formula in several cells by typing the word "Received". When I save and reopen the workbook, as you'd guess, the script above overrides those cells I modified, and I lose the data that I want to keep as "Received" in those cells and it is replaced with the result of the formula (which are dates)"

I need the above to auto run when opening my workbook only if the word "Received" isn't in a cell (and each independent of the other cells in the same range), and only in my worksheet marked as "Training" (Sheet1). Otherwise, I want to leave it as is with that word.

Any help is greatly appreciated.

Author
Account Strength
60%
Account Age
3 years
Verified Email
Yes
Verified Flair
No
Total Karma
215
Link Karma
19
Comment Karma
196
Profile updated: 6 days ago
Posts updated: 17 hours ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
3 years ago