+ Reply to Thread
Results 1 to 4 of 4

How to insert no. of rows under main rows according to no. of family members....?

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    09-14-2011
    Location
    Nepal
    MS-Off Ver
    Office 2021
    Posts
    117

    How to insert no. of rows under main rows according to no. of family members....?

    Dear All,

    I want to insert rows under main rows according to no. of family member along with main rows at once. Eg. No. of family members are 5 then I want to insert more 4 rows under main rows. How can I do within huge document? I will be highly appreciated if you suggest me. The sample file is also attached.


    Thanks.

    Indra
    Attached Files Attached Files
    Last edited by Indra Rai; 10-11-2014 at 02:47 AM.

  2. #2
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: How to insert no. of rows under main rows according to no. of family members....?

    You may try this......
    Sub InsertBlankRows()
    Dim rng As Range, cell As Range
    Dim lr As Long, flr As Long
    lr = Cells(Rows.Count, 7).End(xlUp).Row
    Set rng = Range("G4:G" & lr)
    Application.ScreenUpdating = False
    For Each cell In rng
        If cell <> "" Then
            cell.Offset(1, 0).Resize(cell - 1, 1).EntireRow.Insert
            cell.EntireRow.Copy
            cell.Offset(1, 0).Resize(cell - 1, 1).EntireRow.PasteSpecial xlPasteFormats
        End If
    Next cell
    Range("A3").Select
    Application.CutCopyMode = False
    Application.ScreenUpdating = True
    End Sub
    Please find the attached and click on the Green Button on Test Sheet to see if this works as per your requirement.
    Attached Files Attached Files
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  3. #3
    Forum Contributor
    Join Date
    09-14-2011
    Location
    Nepal
    MS-Off Ver
    Office 2021
    Posts
    117

    Re: How to insert no. of rows under main rows according to no. of family members....?

    Dear sktneer,

    Thanks for your kind help and brilliant mind.

    Indra

  4. #4
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,655

    Re: How to insert no. of rows under main rows according to no. of family members....?

    You're welcome. Glad I could help.
    Moreover you may also click on * (star) to Add Reputation if the solution provided helped you. This is another way to say thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Filter family members
    By mulderm in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-19-2013, 12:02 PM
  2. [SOLVED] Macro code to insert 3 rows on spreadsheet with variable number of rows
    By D18GE in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-17-2013, 07:33 AM
  3. [SOLVED] calculating increase of members that switch rows weekly
    By Dj Duck in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-04-2013, 03:56 PM
  4. [SOLVED] VBA insert/delete rows to accommodate exact number of rows from incoming data
    By iloc in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-12-2012, 06:19 PM
  5. [SOLVED] Insert Multiple Rows Based Off Number in Cell and Copy Data From Above New Rows
    By tstell1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-02-2012, 04:15 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1