Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 846
Default overflow error


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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 846
Default overflow error

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default overflow error

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 846
Default overflow error

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

  #5   Report Post  
Posted to microsoft.public.excel.programming
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

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
Overflow error.. why? Fingerjob Excel Discussion (Misc queries) 4 November 13th 06 05:18 PM
Overflow error Grd Excel Programming 1 January 21st 06 08:13 AM
Overflow Error DG Excel Discussion (Misc queries) 3 April 15th 05 05:45 PM
Overflow Error DG Excel Programming 3 April 15th 05 05:45 PM
Help! Overflow Error 6 Gauthier Excel Programming 6 September 24th 04 12:57 PM


All times are GMT +1. The time now is 03:41 PM.

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"