View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Larry Levinson Larry Levinson is offline
external usenet poster
 
Posts: 42
Default sometimes it takes one variable, sometimes another ...

Given the following:

sub start()
Dim this_day, MyMonth, MyDay, MyYear, MyWeekDay, This_Month
this_day = Date
MyWeekDay = Weekday(this_day)
Select Case MyWeekDay
Case 1
this_day = this_day - 2
Case 2
this_day = this_day - 3
Case 3
this_day = this_day - 1
Case 4
this_day = this_day - 1
Case 5
this_day = this_day - 1
Case 6
this_day = this_day - 1
Case 7
this_day = this_day - 1
End Select

MyMonth = Month(this_day)
MyDay = Day(this_day)
MyYear = Year(this_day)

Select Case MyMonth
Case 1
This_Month = "Jan."
Case 2
This_Month = "Feb."
Case 3
This_Month = "March"
Case 4
This_Month = "April"
Case 5
This_Month = "May"
Case 6
This_Month = "June"
Case 7
This_Month = "July"
Case 8
This_Month = "Aug."
Case 9
This_Month = "Sept."
Case 10
This_Month = "Oct."
Case 11
This_Month = "Nov."
Case 12
This_Month = "Dec."
End Select


Load dayprompt
dayprompt.the_Month.Text = This_Month
dayprompt.the_day.Value = MyDay
dayprompt.the_Year.Text = MyYear
dayprompt.Show
end sub

dayprompt the form has three list boxes, the_Month, the_Day, the_year
....

It initalizes the value for either the_Month or the_Year, but never
both at the same time -- unless you click on the list box -- and it
always does the the_Day.

suggestions please ...
thanks in advance.


Larry Levinson
Talking up to the vocal ...
LLevinson*Bloomberg.net
(remove the star etc ....)