Thread: overflow error
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
FSt1 FSt1 is offline
external usenet poster
 
Posts: 3,942
Default overflow error

hi
post all of your code.

Regards
FSt1

"Brad" wrote:

Since this is a cell in a worksheet I didn't "Dim" anything.




"FSt1" wrote:

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
"Brad" wrote:

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





"Brad" wrote:


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