Set variable to Today + 180 days

How would I rewrite this so strDate results in Today + 180 days and in the formet yyyy-mm-dd  ?
strDate = Format(g_sDate, "yyyy-mm-dd")

Open in new window


not sure what the g_sDate is?  Please advise and thanks.
RWayneHAsked:
Who is Participating?
 
Martin LissConnect With a Mentor Older than dirtCommented:
g_sDate is probably a String variable defined as Public at the top of a code module which means that it can be used anywhere in the workbook.
0
 
Martin LissOlder than dirtCommented:
strDate = Format(DateAdd("d", 180, g_sDate), "yyyy-mm-dd")
0
 
RWayneHAuthor Commented:
Ok.  I see it in a few places in the code.  My attempts at getting strDate defined to Today + 180.

strDate = Format(Date + 180, "yyyy-mm-dd")

Open in new window

 ??
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
RWayneHAuthor Commented:
It worked!!! I was totally guessing.
0
 
RWayneHAuthor Commented:
thanks for the help.
0
 
Martin LissOlder than dirtCommented:
You’re welcome and I’m glad I was able to help.

If you expand the “Full Biography” section of my profile you’ll find links to some articles I’ve written that may interest you.

Marty - Microsoft MVP 2009 to 2017
              Experts Exchange Most Valuable Expert (MVE) 2015, 2017
              Experts Exchange Top Expert Visual Basic Classic 2012 to 2017
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.