Remember variable when it is called from another sub

S

slickdock

I have a sub that adds 1, 2 and 3 weeks to a user inputted date. I
want to call this routine from several other subs. How can I make the
original sub see the calls?

Sub Original()
Call DateCalc()
'Macro now finds location and needs to plug in 2 week follow up
letter date:
Selection.InsertBefore Ltr2wkDate
End Sub

Sub DateCalc()
Dim LtrDate As Date
LtrDate = inputbox("Desired letter date (TYPE NUMERICALLY, LIKE M/D/
YY:")
Dim Ltr0Date As String
Ltr0Date = Format(LtrDate, "mmmm d, YYYY")
Dim Ltr1wkDate As String
Ltr1wkDate = Format(DateAdd("ww", 1, Ltr0Date), "mmmm d, YYYY")
Dim Ltr2wkDate As String
Ltr2wkDate = Format(DateAdd("ww", 2, Ltr0Date), "mmmm d, YYYY")
End Sub

Thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top