Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
cdate problem
Hi,
I have some code for user forms that require date entry. Some of the date fields can be left blank but when the code runs it errors out because my code refers to a blank variable as a cdate. I have phrased this statement within an if so that it should only run if the date field is not blank but it still comes up as a type mismatch error. Any ideas? Let me know if you need more explanation. Thanks in advance for any help you can offer. JohnP |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
cdate problem
It would help if you could show us your code.
Rick "JohnP" wrote in message ... Hi, I have some code for user forms that require date entry. Some of the date fields can be left blank but when the code runs it errors out because my code refers to a blank variable as a cdate. I have phrased this statement within an if so that it should only run if the date field is not blank but it still comes up as a type mismatch error. Any ideas? Let me know if you need more explanation. Thanks in advance for any help you can offer. JohnP |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
cdate problem
Hi Rick,
See code section below. I know its not the best. Still quite new to this! Thanks, If FromFullDate.Value < "" Then Sheets("Template").Select Range("A9").Activate j = 9 While CDate(ActiveCell.Value) < CDate(FromFullDate.Value) ActiveCell.Offset(1, 0).Activate j = j + 1 Wend If ActiveCell.Interior.ColorIndex = 1 Then Application.ScreenUpdating = True MsgBox Prompt:="" & CDate(FromFullDate.Value) & " is a weekend or a bank holiday. Please select a weekday.", _ Buttons:=vbOKOnly + vbExclamation FromFullDate = "" Exit Sub End If End If "Rick Rothstein (MVP - VB)" wrote: It would help if you could show us your code. Rick "JohnP" wrote in message ... Hi, I have some code for user forms that require date entry. Some of the date fields can be left blank but when the code runs it errors out because my code refers to a blank variable as a cdate. I have phrased this statement within an if so that it should only run if the date field is not blank but it still comes up as a type mismatch error. Any ideas? Let me know if you need more explanation. Thanks in advance for any help you can offer. JohnP |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
cdate problem
While the code is not how I would have written it, it appears to work fine
from the test I did. Tell us *exactly* what problem are you having that prompted you to ask your question (give details so we can reproduce the problem on our own computers)? Rick "JohnP" wrote in message ... Hi, I have some code for user forms that require date entry. Some of the date fields can be left blank but when the code runs it errors out because my code refers to a blank variable as a cdate. I have phrased this statement within an if so that it should only run if the date field is not blank but it still comes up as a type mismatch error. Any ideas? Let me know if you need more explanation. Thanks in advance for any help you can offer. JohnP |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
On error resume next and cdate problem | Excel Programming | |||
CDate Problem | Excel Programming | |||
CDate and IsDate | Excel Programming | |||
CDATE issues | Excel Programming | |||
What is the differance between cdate and ... | Excel Programming |