Automatic date


Need one more help with a simple job.

I want to write a text in excel (e,g, Daily workflow report for 08-Jan-2019). I need that we just need to type  "Daily workflow report for [xxxxxxxxx]" the date should take automatic.
but the issue is that we need one day before of current date (e.g if today is 08-Jan-2019 so it should take 07-Jan-2019 date)
Satish GuptaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sam JacobsDirector of Technology Development, IPMCommented:
="Daily Workflow Report for " & TEXT(TODAY()-1,"dd-MMM-yyyy")

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
Is it always the cell F9 where you want to have the text "Daily workflow report for" followed by yesterday's date or it can be any cell on the sheet?
In any case you don't even need to type the text "Daily workflow report for", with the code given below you can type anything a number or a letter in F9 and once you hit enter the F9 will be populated with "Daily workflow report for" followed by the yesterday's date.

The following code is placed on "08-Jan-2018" Sheet Module.
To test the code, just type anything in the cell F9 and hit enter.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.CountLarge > 1 Then Exit Sub
If Target.Address(0, 0) = "F9" Then
    If Target <> "" Then
        Application.EnableEvents = False
        Target.Value = "Daily Report for " & Format(Date - 1, "dd-mmm-yyyy")
        Application.EnableEvents = True
    End If
End If
End Sub

Open in new window

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.