Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Inputbox Default to be Upcomming Sunday
I have a input box that is looking for a date.
DT = InputBox("Enter New Date: ", Date) I would like have the default value of the inputbox as the upcomming sunday( Today is 6-29-06 default value should show 7-2-06) Thanks in advance |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Inputbox Default to be Upcomming Sunday
I figured it out by using the following code
Sub sunday() If Weekday(Date) = vbSunday Then DaT = Date ElseIf Weekday(Date) = vbMonday Then DaT = Date + 6 ElseIf Weekday(Date) = vbTuesday Then DaT = Date + 5 ElseIf Weekday(Date) = vbWednesday Then DaT = Date + 4 ElseIf Weekday(Date) = vbThursday Then DaT = Date + 3 ElseIf Weekday(Date) = vbFriday Then DaT = Date + 2 ElseIf Weekday(Date) = vbSaturday Then DaT = Date + 1 End If End Sub Brian wrote: I have a input box that is looking for a date. DT = InputBox("Enter New Date: ", Date) I would like have the default value of the inputbox as the upcomming sunday( Today is 6-29-06 default value should show 7-2-06) Thanks in advance |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Inputbox Default to be Upcomming Sunday
Sub Temp()
Dim intDOW As Integer Dim DT As String Dim datNewDate As Date intDOW = Weekday(Date, vbSunday) datNewDate = Date + (7 - intDOW + 1) DT = InputBox("Enter New Date: ", datNewDate) ' The rest of your code goes here End Sub Note that to display the next Sunday in the InputBox, not its title, you would use DT = InputBox("Enter New Date: ", , datNewDate) Mark Brian wrote: I have a input box that is looking for a date. DT = InputBox("Enter New Date: ", Date) I would like have the default value of the inputbox as the upcomming sunday( Today is 6-29-06 default value should show 7-2-06) Thanks in advance |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Sunday | Excel Worksheet Functions | |||
InputBox default value? | Excel Programming | |||
Inputbox and Application.InputBox | Excel Programming | |||
Application.InputBox with Default:=0 testing False | Excel Programming | |||
Excel VBA - InputBox DEFAULT Value? | Excel Programming |