View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Another Quick Simple VBA question (if...then statement)

? 2/2/04
0.25

Sure that is the test you intended?

--
Regards,

Tom Ogilvy


"Paul Robinson" wrote in message
om...
Hi
If ComboBox1.Value = "January" then
If Date<2/2/04 then
CheckBox1.enabled = False
end if
end if

should work. This assumes that you are using the US date syntax of
mm/dd/yy. If that is a problem, you might be better off using the
DateSerial or DateValue functions. For example, using the date 3/2/04
to mean 2nd Mar 2004 (US syntax) you can make it less ambiguous for
non US users by writing
DateSerial(04,3,2)
, or by using an unambiguous date format by writing
DateValue("Mar 2, 2004")

So that your first If statement is now
If Date<DateSerial(04,3,2) then

regards
Paul

abxy wrote in message

...
in VB, how do i write:

if Combobox1 = "January" and today's date(system date) isn't equal to
2/2/04 or later then checkbox1.enabled = false

thanks! : )


---
Message posted from http://www.ExcelForum.com/