Consulting

Results 1 to 3 of 3

Thread: Merging Cell EntireRow.Insert Excel 2003

  1. #1
    VBAX Regular
    Joined
    May 2012
    Posts
    64
    Location

    Merging Cell EntireRow.Insert Excel 2003

    I need to merge cells from this following VB Code

    [VBA]
    If Target.Count > 1 Then Exit Sub
    If Not Intersect(Target, Range("B5:B100")) Is Nothing Then
    NumRows = Target.Value - 1
    For R = 1 To NumRows
    Target.Offset(1, 0).EntireRow.Insert
    Next R
    [/VBA]

    The Column will be P

    So if "004" is inserted in B5 then Column P Cell 5, 6, 7 and 8 will Merge.

    Help from you genius is always appreciated

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [VBA]If Target.Count > 1 Then Exit Sub
    If Not Intersect(Target, Range("B5:B100")) Is Nothing Then
    numrows = Target.Value
    Target.Offset(1, 0).Resize(numrows).EntireRow.Insert
    Me.Cells(Target.Row, "P").Resize(numrows).Merge
    End If
    [/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

  3. #3
    VBAX Regular
    Joined
    May 2012
    Posts
    64
    Location

    Complete

    Works like a charm, xld you are a talented one

Posting Permissions

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