overflow error

  • Thread starter Thread starter Brad
  • Start date Start date
B

Brad

Using Excel 2007 - with compatibilty witn 2003.

Trying to find problems with my VBA code

I have a cell that is set up to accept dates (range named "cdate"). If an
individaul enter 04012009 in that cell, I get an "overfloww" error.

What options do I have to capture this event?

The VBA code breaks at the following line.
If Range("cdate").Value = "" Then
 
One solution - are there better solutions

On Error GoTo ErrCorrect
..
..
..

ErrCorrect:
If Target.Address = Range("cdate").Address Then
MsgBox ("Please use slashes (/) when entering dates")
If Left(Range("prod1").Value, 3) = "LBD" Then
Range("cdate").Value = DateSerial(2007, 1, 1)
Else
Range("cdate").Value = DateSerial(1984, 12, 1)
End If
End If
 
hi
overflow problem usuallly stem from misdeclared dims so I think the real
problem is in your declarations. you may have the date set to integer.
integer will only hold up to 32700??or so. today's serial data is 39905
which would produce an overflow ie to big of a number for so small of
container.
in vb help type "data types" for more info on this.

regards
FSt1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top