View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Gauthier Gauthier is offline
external usenet poster
 
Posts: 6
Default Help! Overflow Error 6

oh oh...i rec'd this code from another valuable contributor and it worked
fine at first, however, the data changed, and now i get a OVERFLOW ERROR 6
when it gets to line 5 ?? the code fills down the numeric value, until it
reaches the next value, then takes THAT value, and fillsdown until the next
value, and so on, and so on...
-----------------------------------------------------------------------
debugging shows the following values for;
lngLastNum = 42010101
CLng(rngCell.Value) = 4201010101
-----------------------------------------------------------------------
Cell C1 (where it starts) has the following value: 4201
the next value encountered is: 42010101 - and it fills down correctly
next value encountered is: 4201010101 - that's when the b/o error occurs
------------------------------------------------------------------------
ACTUAL CODE
line
1 ' FILLDOWN TERRITORY NUMBERS
2 Dim rngCell As Range
3 Dim lngLastNum As Long

4 Set rngCell = Range("C1")
5 lngLastNum = CLng(rngCell.Value)

While Not IsEmpty(rngCell)
If IsNumeric(rngCell.Value) Then
lngLastNum = rngCell.Value
Else
rngCell.Value = lngLastNum
End If
Set rngCell = rngCell.Offset(1)
Wend
---------------------------------------------------------------
APPRECIATE YOUR ASSISTANCE - AS ALWAYS!
Sandi