Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
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
On error resume next and cdate problem [email protected] Excel Programming 2 August 18th 05 03:01 PM
CDate Problem sil0000 Excel Programming 7 July 22nd 05 08:24 AM
CDate and IsDate Geoff Excel Programming 3 June 4th 05 02:20 PM
CDATE issues Marcus Excel Programming 1 November 12th 04 10:02 AM
What is the differance between cdate and ... Bruccce Excel Programming 3 August 7th 03 09:00 PM


All times are GMT +1. The time now is 11:26 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"