Consulting

Results 1 to 2 of 2

Thread: Insert new Row

  1. #1
    VBAX Contributor
    Joined
    Jun 2008
    Posts
    169
    Location

    Insert new Row

    Hi
    Any one can help me the VB code to rows count by column B when if column A cells value = mascross” than insert a rows on above the cells “mascross”.

    Your help I highly appreciate
    Thanks very much

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]
    With Activesheet

    LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
    For i = LastRow - 1To 1 Step -1

    If .Cells(i, "B").Value2 = "mascross" Then

    .Rows(i + 1).Insert
    End If
    Next i
    End With
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •