+ Reply to Thread
Results 1 to 3 of 3

Insert rows based on values in column

  1. #1
    Registered User
    Join Date
    07-11-2013
    Location
    ky
    MS-Off Ver
    Excel 2007
    Posts
    2

    Insert rows based on values in column

    I am new to macros. I have values in column A and a quantity in column B. I need to insert rows below the value in A based on the quantity in B. Also, the value in A needs to be copied into the new rows. If the quantity is 10, I need 9 more rows below.
    EX:
    40100 1
    40101 3
    40102 1
    40103 4

    needs to be:

    40100 1
    40101 3
    40101
    40101
    40102 1
    40103 4
    40103
    40103
    40103

    Any help with this matter would be greatly appreciated!!

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Insert rows based on values in column

    Hi, scott,

    one way could be a loop starting at the bottom and working up like
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    How to install your new code
    1. Copy the Excel VBA code
    2. Select the workbook in which you want to store the Excel VBA code
    3. Press Alt+F11 to open the Visual Basic Editor
    4. Choose Insert > Module
    5. Edit > Paste the macro into the module that appeared
    6. Close the VBEditor
    7. Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)

    To run the Excel VBA code:
    1. Press Alt-F8 to open the macro list
    2. Select a macro in the list
    3. Click the Run button
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    07-11-2013
    Location
    ky
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Insert rows based on values in column

    That absolutely wonderful! That works great, thank you!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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