Thread: Date in VBA
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
StephanieH StephanieH is offline
external usenet poster
 
Posts: 95
Default Date in VBA

I have the following If then statements:
If PublishMonth = "10/1/2005" Then MsgBox ("Add C1ANC Goals to Actuals, 1-3
and 4-6 (use N/A)")
If PublishMonth = "2/1/2006" Then MsgBox ("Remove N/A. Use C1ANC's batch
numbers")
If PublishMonth = "3/1/2006" Then MsgBox ("Add 7-9 and adjust to leader's.
Remove N/A. ")
If PublishMonth = "4/1/2006" Then MsgBox ("Adjust 7-9 to leader's")
If PublishMonth = "5/1/2006" Then MsgBox ("Adjust 7-9 to leader's")
If PublishMonth = "6/1/2006" Then MsgBox ("Adjust 7-9 to leader's")
If PublishMonth = "7/1/2006" Then MsgBox ("Adjust 10-12 to leader's")
If PublishMonth = "8/1/2006" Then MsgBox ("Adjust 10-12 to leader's")
If PublishMonth = "9/1/2006" Then MsgBox ("Adjust 10-12 to leader's")

Instead of counting out 6 months from 10/1/05 and entering 2/1/06 into the
statement, how can I have VBA figure 6 months from 10/1/05? Something like
If PublishMonth = 10/1/05 + 6 then ......
If PublishMonth = 10/1/05 + 7 then ......