View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Toppers Toppers is offline
external usenet poster
 
Posts: 4,339
Default InputBox requesting dates between two predefined dates

Barb,
Perhaps something along these lines. For this example, I set
SummaryMin as the default date.

Sub InForm()

Dim SummaryMin As Date, CPI_SPI_PITD_LastMo As Date, GetDate as Date

SummaryMin = "01/01/2006"
CPI_SPI_PITD_LastMo = "31/01/2006"

Do
getDate = DateValue(Application.InputBox("Enter Date between " & SummaryMin
& " and " & CPI_SPI_PITD_LastMo, "Title date ", SummaryMin, Type:=2))
If getDate = "False" Then Exit Sub ' Cancel
If Not Application.And(getDate = SummaryMin, getDate <=
CPI_SPI_PITD_LastMo) Then
MsgBox "Invalid date. Please re-enter"
End If
Loop Until Application.And(getDate = SummaryMin, getDate <=
CPI_SPI_PITD_LastMo)
End Sub

"Barb Reinhardt" wrote:

I'm trying to figure out how to display this programmatically for the user.
I want the user to enter a date between the following two dates:

Date 1 is defined as SummaryMin
Date 2 is defined named variable CPI_SPI_PITD_LastMo

I want them to enter the date they want to use (or select one of the two).
How would y'all approach this.

Thanks in advance,
Barb Reinhardt