Excel opens asking for a date

0

I am creating a spreadsheet that needs to ask the user to input a date upon opening the workbook. The answer field needs to include a valid date range that goes back 13 months.

Once a valid date has been input, it then needs to open a data folder and populate a specific matrix.

This is the first part of the project. Any help would be appreciated.

Patricia Ziegler

Posted 2014-02-22T02:58:46.760

Reputation: 9

1Welcome to SU! That's a great description of a problem, but not much of a question. How are you implementing this? What have you got so far? Where exactly are you getting stuck? – Ƭᴇcʜιᴇ007 – 2014-02-22T04:03:30.733

Answers

1

Here is a way to ask for a date without using match.com:

Sub AskingForADate()
    Dim d As Date, dOld As Date
    Dim OK As Boolean
    dOld = DateSerial(Year(Date), Month(Date) - 13, Day(Date))
    OK = False
    While Not OK
        d = Application.InputBox(Prompt:="Enter a date within the last 18 months", Type:=1)
        If d <= Date And d >= dOld Then
            OK = True
        Else
            MsgBox "Not valid"
        End If
    Wend
End Sub

Gary's Student

Posted 2014-02-22T02:58:46.760

Reputation: 15 540