Inserting Multiple Rows into Spreadsheet

A

Auburn Jon

I have several spreadsheets of 14,000-15,000 lines each that need rows added
at intervals determined by an ID code in column A. The number of rows of
data varies from 7 to 24. The macros I've seen posted deal with a more fixed
interval. Can this be modified to essentially add rows at random, or is
there another possibility?

Thanks for any Info
 
J

Joel

Rows can be added with a macro by looking at data on the worksheet to
determine where rows ae added.

Sub AddRows()

IDNum = 123
LastRow = Range("A" & Rows.Count).end(xlup).Row
for RowCount = LastRow to 1 step -1
if Range("A" & RowCount) = IDNum then
Rows(RowCount + 1).Insert
end if
next RowCount

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top