Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Error Code 6

Death to Integer! I never Dim Integer (even For i = 1 to 10) unless I call a
routine that requires it!

"Dave" wrote:

Thanks to both of you...that makes sense!!! It worked

"David Hepner" wrote:

Try:

Dim J as Long instead of integer


"Dave" wrote:

I am using lastrow and for some reason I get an overflow error 6 at the "For"
statement. THe spreadsheet has 39,000 lines of data (only 10 columns wide).
THis macro works on all other of my sheets that go up to 26,000 but for some
reason blows up at 39,000.

Anybody have any ideas or advice?

Thanks,
Dave

Public Sub Rpt_Clnr()
Dim J As Integer
Dim Mystr

lastrow = ActiveSheet.UsedRange.Rows.Count

For J = 20000 To lastrow
Mystr = Left((ActiveSheet.Range("A:A").Rows(J).Text), 4)
If Mystr = "Date" Then
ActiveSheet.Rows(J).Delete
J = J - 1
ElseIf Mystr = "CFM " Then
ActiveSheet.Rows(J).Delete
J = J - 1
ElseIf Mystr = " " Then
ActiveSheet.Rows(J).Delete
J = J - 1
ElseIf Mystr = "----" Then
ActiveSheet.Rows(J).Delete
J = J - 1
ElseIf Mystr = "Item" Then
ActiveSheet.Rows(J).Delete
J = J - 1
End If
Next

ActiveSheet.Range("a1").Activate
lastrow = ActiveSheet.UsedRange.Rows.Count
ActiveSheet.Range("A1") = lastrow - 19

End Sub

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
error with code terilad Excel Discussion (Misc queries) 4 April 12th 10 06:20 PM
VBA error code Ray Excel Programming 5 April 12th 05 02:09 PM
Getting error in code Jim May[_4_] Excel Programming 4 September 20th 04 03:12 PM
How can I still go to the error-code after a On Error Goto? Michel[_3_] Excel Programming 2 May 4th 04 04:21 AM
Code Error - Run Time Error 5 (Disable Cut, Copy & Paste) Tim[_36_] Excel Programming 4 April 23rd 04 02:53 AM


All times are GMT +1. The time now is 03:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"