If I correctly understand your requirement this code should do: Sub InsertRowsAfter8DigitRow() Dim r As Range Set r = ActiveSheet.UsedRange.Columns("B") Dim rCell As Range For Each rCell In r.Cells If rCell.Row >= 3 Then If rCell.Offset(-1).Value = "" And Is8DigitCode (rCell.Offset(-2).Value) Then rCell.Rows.EntireRow.Insert End If End If Next rCell End Sub
Function Is8DigitCode(s As String) As Boolean If IsNumeric(Left(s, 4)) And Mid(s, 5, 1) = "." And IsNumeric(Right (s, 4)) Then Is8DigitCode = True Else Is8DigitCode = False End If End Function Hope this helped, Rolf On Oct 22, 4:00 am, Hassan Tariq <htari...@gmail.com> wrote: > Dear All, > > Please help is it possible for > > Macro to insert a new row if column B of previous row is blank and the > row before of Column B includes 8-digit code. > > For Example > > Column B > Row 8 > Row 9 > Row 10 1111.2222 > Row 11 > Row 12 > Row 13 > Row 14 > Row 15 2222.3333 > Row 16 > Row 17 > Row 18 > Row 19 > Row 20 > > I am looking for help for macro to insert a new row after Row 11 & 16 > and other such rows --~--~---------~--~----~------------~-------~--~----~ ---------------------------------------------------------------------------------- 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 <><><><><><><><><><><><><><><><><><><><><><> HELP US GROW !! We reach over 6,500 subscribers worldwide and receive many nice notes about the learning and support from the group. Our goal is to have 10,000 subscribers by the end of 2009. Let friends and co-workers know they can subscribe to group at http://groups.google.com/group/excel-macros/subscribe -~----------~----~----~----~------~----~------~--~---