Hi Sandeep,

My code below assumes the following

1. The serial numbers are in column A
2. The Excel version you are using is 2007.
3. The code is good for 10,000 rows. Please modify if required.

Sub Serial()
Dim i As Long
For i = 1 To 10000
 If Cells(i, 1) <> "" And Cells(i + 1, 1) <> "" Then
    If Cells(i + 1, 1) - Cells(i, 1) > 1 Then
        Rows(i + 1 & ":" & i + 1).Select
        Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
        i = i + 1
    End If
 Else
    Exit For
 End If
Next i
End Sub



On Wednesday, March 21, 2012 9:40:37 PM UTC+5:30, sandeep chhajer wrote:
>
> Dear all,
>
> Please find my attachment ( I know asking question in this way is a 
>  violation of our forum rule but sorry I don't have data card to copy the 
> queries from excel)
>
> Thanking you in advance.
>
> Sandeep Chhajer.
>
>
On Wednesday, March 21, 2012 9:40:37 PM UTC+5:30, sandeep chhajer wrote:
>
> Dear all,
>
> Please find my attachment ( I know asking question in this way is a 
>  violation of our forum rule but sorry I don't have data card to copy the 
> queries from excel)
>
> Thanking you in advance.
>
> Sandeep Chhajer.
>
>

-- 
FORUM RULES (986+ members already BANNED for violation)

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.

2) Don't post a question in the thread of another member.

3) Don't post questions regarding breaking or bypassing any security measure.

4) Acknowledge the responses you receive, good or bad.

5)  Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 

NOTE  : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.

------------------------------------------------------------------------------------------------------
To post to this group, send email to excel-macros@googlegroups.com

Reply via email to