Hi Dustin,
Paste the following code into a module.

Sub InsertMissing()

    Do Until ActiveCell.Value = ""
        A = ActiveCell.Value
        B = ActiveCell.Offset(1, 0).Value
        If B - A > 1 Then
            ActiveCell.Offset(1, 0).EntireRow.Select
            Selection.Insert Shift:=xlDown
            ActiveCell.Value = ActiveCell.Offset(-1, 0) + 1
        Else: ActiveCell.Offset(1, 0).Select
        End If
    Loop
    
End Sub


Before running, save your workbook in case something "unexpected" happens.
You have to select the first numbered cell in your list, then run the code.
Hope this helps.
Regards - Dave.


> Date: Mon, 20 Apr 2009 07:57:06 -0700
> Subject: $$Excel-Macros$$ Need Help with Macro, Insert Rows based on another 
> cell's value
> From: dustin.ho...@gmail.com
> To: excel-macros@googlegroups.com
> 
> 
> Hello! I am new to this group, and new to VBA in general, so I would
> appreciate any insight / explanations into this =)
> 
> Here is the situation:
> 
> There will be raw data in the form of a spreadsheet which is in
> chronological order, though not in steps of 1. So for instance, Column
> A could be numbered 1,2,3,4,5,15,16,45 ...etc. There will also be
> corresponding data in columns following it. The following is an
> example of what it could look like (Columns A and B, though there will
> be many more columns)
> 
> 100   this is 100
> 101   this is 101
> 102   this is 102
> 103   this is 103
> 104   this is 104
> 110   this is 110
> ...
> 
> 
> What I need this macro to do, is to insert a row where the order is
> not in steps of 1, and then copy the appropriate number into that new
> row. Thus:
> 
> 100   this is 100
> 101   this is 101
> 102   this is 102
> 103   this is 103
> 104   this is 104
> 105
> 106
> 107
> 108
> 109
> 110   this is 110
> ...
> 
> I would super appreciate help with this!
> 
> Thanks!!
> 
> Dustin
> 
> > 

_________________________________________________________________
Need a new place to rent, share or buy? Let ninemsn property search for you.
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fninemsn%2Edomain%2Ecom%2Eau%2F%3Fs%5Fcid%3DFDMedia%3ANineMSN%5FHotmail%5FTagline&_t=774152450&_r=Domain_tagline&_m=EXT
--~--~---------~--~----~------------~-------~--~----~
-------------------------------------------------------------------------------------
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com or
Ashish Jain @ 26may.1...@gmail.com
-------------------------------------------------------------------------------------
-~----------~----~----~----~------~----~------~--~---

Reply via email to