Hi Sandeep, Before I proceed to modify the code, could you let me know the following
1. Which version of excel are you using 2. Do you want the code to insert the rows equivalent to the missing serial numbers for e.g. if after number 3 you have 7, do you want the code to insert 4 rows in the middle of 3 and 7. Regards, Damimkader S. Meeran On Thursday, March 22, 2012 1:50:18 PM UTC+5:30, sandeep chhajer wrote: > > Dear Damimkader, > > while I am running this code I am getting the follwing error code > run time error 13 > > type mismatch > > please help. > > > My problem has been reproduced > > My current Data is like this Sr. No. S_DISNO S_DISC S_UNIT S_SELP > Purchse > quantity 495061 358 SILK DUPPATTA 0.90m 260.00 36.00 495062 359 SILK > DUPPATTA 1.15m 385.00 33.00 495063 351 SILK DOTHI 8 cu 3.6 > m 2645.00 4.00 495067 351 SILK DOTHI 8 cu 3.6 m 2745.00 > 3.00 495070 351 SILK DOTHI 8 cu 3.6 m 2965.00 3.00 > > > I want my data as follows > > Sr. No. S_DISNO S_DISC S_UNIT S_SELP Purchse quantity 495061 358 SILK > DUPPATTA 0.90m 260.00 36.00 495062 359 SILK DUPPATTA 1.15m 385.00 33.00 > 495063 351 SILK DOTHI 8 cu 3.6 m 2645.00 4.00 495064 > 351 SILK DOTHI 8 cu 3.6 m 2645.00 4.00 495065 351 SILK > DOTHI 8 cu 3.6 m 2645.00 4.00 495066 351 SILK DOTHI > > 8 cu 3.6 m 2645.00 4.00 495067 351 SILK DOTHI 8 cu 3.6 m > 2745.00 3.00 495068 351 SILK DOTHI 8 cu 3.6 m 2745.00 > 3.00 495069 351 SILK DOTHI 8 cu 3.6 m 2745.00 3.00 > 495070 351 SILK DOTHI 8 cu 3.6 m 2965.00 3.00 > > > > Copy the previous line only sr no has chamged by adding 1 > > > > > > On 22 March 2012 02:26, Damimkader S. Meeran <damim.ka...@gmail.com>wrote: > >> 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. >>> >>> > > > -- > Regards, > Sandeep Kumar 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