Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help! Inserting Rows

I'm using the following code to insert rows into a spreadsheet. It
has worked just fine. Once the Do Until ActiveCell.Value finds a
value that does not match, it inserts a row between those values
(example below). The problem is the spreadsheet keeps growing the
macro works until it reaches a certain point, around row 2000 then I
receive an error and Excel closes down. Does anyone have any
suggestions as to how I can get around this. Thanks for any help.
Juls

SYJ12345
SYJ12345
(inserts row)
SYJ45678
SYJ45678

Sub Insert_Rows()

Range("G10").Select

Do Until ActiveCell.Value = ""
If ActiveCell.Value = ActiveCell.Offset(-1, 0).Value Then
ActiveCell.Offset(1, 0).Select
Else:
Selection.EntireRow.Insert
ActiveCell.Offset(2, 0).Select

End If
Loop
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Help! Inserting Rows

Code worked fine for me processing 5000 cells, adding over 3500 rows.

It stopped on Row 8751 when it found a blank cell.

xl2000, SR1, US English, Win 2K.

--
Regards,
Tom Ogilvy


"JulsMarie" wrote in message
om...
I'm using the following code to insert rows into a spreadsheet. It
has worked just fine. Once the Do Until ActiveCell.Value finds a
value that does not match, it inserts a row between those values
(example below). The problem is the spreadsheet keeps growing the
macro works until it reaches a certain point, around row 2000 then I
receive an error and Excel closes down. Does anyone have any
suggestions as to how I can get around this. Thanks for any help.
Juls

SYJ12345
SYJ12345
(inserts row)
SYJ45678
SYJ45678

Sub Insert_Rows()

Range("G10").Select

Do Until ActiveCell.Value = ""
If ActiveCell.Value = ActiveCell.Offset(-1, 0).Value Then
ActiveCell.Offset(1, 0).Select
Else:
Selection.EntireRow.Insert
ActiveCell.Offset(2, 0).Select

End If
Loop
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
inserting rows inbetween rows of data ? Azeem Excel Discussion (Misc queries) 1 October 27th 09 07:38 AM
Copying & Inserting Rows w/o Affecting other Rows Etc. LRay67 Excel Worksheet Functions 1 October 22nd 08 02:10 AM
Inserting Blank rows after every row upto 2500 rows Manju Excel Worksheet Functions 8 August 22nd 06 12:54 PM
Inserting Rows GOL Excel Discussion (Misc queries) 2 October 27th 05 08:18 PM
Inserting rows LeRoy New Users to Excel 2 March 15th 05 03:58 PM


All times are GMT +1. The time now is 04:26 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"