Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sunday Dale[_4_] Excel Worksheet Functions 8 November 7th 12 09:27 AM
InputBox default value? Lunks Excel Programming 4 May 26th 06 06:32 PM
Inputbox and Application.InputBox Maria[_7_] Excel Programming 1 September 20th 04 11:36 AM
Application.InputBox with Default:=0 testing False bluhme Excel Programming 2 June 24th 04 12:35 PM
Excel VBA - InputBox DEFAULT Value? BruceAtkinson[_3_] Excel Programming 3 May 26th 04 08:18 PM


All times are GMT +1. The time now is 02:10 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"