+ Reply to Thread
Results 1 to 3 of 3

Insert rows based on a cell value and Fill down column A

  1. #1
    Registered User
    Join Date
    12-04-2014
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    2

    Insert rows based on a cell value and Fill down column A

    Hi All,

    I've been re-searching my issue for hours now and still nothing that can really help me. I'm not a programmer but can get by with a bit of VB.

    My issue -

    I am trying to insert rows based on a count of values in cells. This will allow me to fill down data (copy same text) to essentially transpose the fields.
    The example below is what i want to insert rows below for each model.

    MODEL SP Code SP Code SP Code SP Code SP Code Count
    MODEL4 artfacq1 artfacq2 artfacq3 artfacq4 4
    MODEL23 artfacq6 artfacq7 artfacq8 artfacq8 artfacq9 5
    MODEL21 artfacq11 artfacq12 artfacq13 3

    The finished output would look like below

    MODEL SP Code SP Code SP Code SP Code SP Code Count
    MODEL4 artfacq1
    MODEL4 artfacq2
    MODEL4 artfacq3
    MODEL23 artfacq4
    MODEL23 artfacq6
    MODEL23 artfacq7
    MODEL23 artfacq8
    MODEL23 artfacq8
    MODEL21 artfacq9
    MODEL21 artfacq11
    MODEL21 artfacq12
    MODEL21 artfacq13

    I found some VB code to insert the row based on value and have added into my excel file. This works (kinda) but i can't figure the rest out as it's too complicated for my vb expertise.

    Sub Test()
    For N = Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1
    If Cells(N, 7) <> "" And Cells(N, 7) <> 1 Then
    Rows(N + 1 & ":" & N + Cells(N, 7) - 1).Insert
    End If
    Next N
    End Sub

    Please see my attached excel sheet and let me know if this is even possible.

    Thanks :D
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    10-03-2010
    Location
    India
    MS-Off Ver
    Excel 2007, 2010
    Posts
    10

    Thumbs up Re: Insert rows based on a cell value and Fill down column A

    Hello Blaxor,
    Use below code to get desired output:
    Please Login or Register  to view this content.
    Please find attached updated file.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    12-04-2014
    Location
    Australia
    MS-Off Ver
    2010
    Posts
    2

    Re: Insert rows based on a cell value and Fill down column A

    Hi Raj,

    This is excellent! Exactly what I needed.

    I can now modify slightly for larger ranges and user input.

    Great work. Much appreciated. :D

    blaxor
    Last edited by blaxor; 12-07-2014 at 06:46 PM.

+ 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. Replies: 3
    Last Post: 10-17-2014, 02:29 PM
  2. [SOLVED] Insert rows in column based on data from in another column
    By Lisa4legin in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-31-2014, 05:50 PM
  3. Insert x rows based on the column value
    By Snap132 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-28-2010, 03:27 AM
  4. Insert rows based on the value on column F
    By sramchan in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-03-2009, 02:01 PM
  5. [SOLVED] Auto Fill Column with Date based on rows in other column
    By JOUIOUI in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-06-2006, 01:35 PM

Tags for this Thread

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