+ Reply to Thread
Results 1 to 4 of 4

Create VBA Macro to create new rows according to data between Sheet1 and Sheet2

  1. #1
    Registered User
    Join Date
    06-16-2015
    Location
    New York
    MS-Off Ver
    2011 (mac)
    Posts
    6

    Post Create VBA Macro to create new rows according to data between Sheet1 and Sheet2

    Hello,

    I am trying to create a macro for image names that will create blank rows between higher level numbers on Sheet1 according to data on sheet 2.

    For example:
    Column A Sheet1
    1111
    1112
    1113
    1114
    1115

    Column A Sheet2
    1111-1
    1111-2
    1111-3
    1111-4
    1111-5
    1111-6
    1111-7
    1111-8
    1112-1
    1112-2
    1112-3
    1112-4
    1112-5
    1112-6
    1112-7
    1113-1
    1113-2
    1113-3
    1113-4
    1113-5
    1113-6
    1114-1
    1114-2
    1114-3
    1114-4
    1114-5
    1114-6
    1114-7
    1114-8
    1114-9

    I need to figure out how to insert (according to above example) 9 rows of space between 1111 and 1112 on Sheet1 according to how many images there are on sheet 2 for 1111. Any ideas? Thank you in advance for your time and input.

    kbot

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Create VBA Macro to create new rows according to data between Sheet1 and Sheet2

    Try this macro

    Please Login or Register  to view this content.
    Open up the VBA editor by hitting ALT F11

    Insert a new module by hitting Insert - Module

    Paste the macro into the empty sheet

    Hit ALT F11 to get back to the worksheet.

    Run the macro by going to tools-macro in Excel 2003 or the view ribbon in Excel 2007/2010/2013.
    Martin

  3. #3
    Registered User
    Join Date
    06-16-2015
    Location
    New York
    MS-Off Ver
    2011 (mac)
    Posts
    6

    Re: Create VBA Macro to create new rows according to data between Sheet1 and Sheet2

    Thank you for your response, MRICE! It works beautifully! The only one issue, the macro shifts one less cell than needed (example below). What do I need to adjust to correct? Thanks for your time and info. -Kcarth

    1897 1897-.jpg
    1897-.jpg
    1897-.jpg
    1897-.jpg
    1897-jpg
    1898-.jpg
    1898 1898-.jpg
    1898-.jpg
    1898-.jpg
    1898-.jpg
    1898-.jpg
    1898-.jpg
    1898-.jpg
    1898-.jpg
    1899-.jpg
    1899-.jpg
    1899 1899-.jpg
    1899-.jpg
    1899-.jpg
    1899-.jpg
    1899-.jpg
    1900-.jpg
    1900-.jpg
    1900-.jpg
    1900 1900-.jpg
    1900-.jpg
    1900-.jpg
    1900-.jpg
    1901-.jpg
    1901-.jpg
    1901-.jpg
    1901-.jpg
    1901 1901-.jpg
    1901-.jpg
    1901-.jpg
    1902-.jpg
    1902-.jpg
    1902-.jpg
    1902-.jpg
    1902-.jpg
    Attached Files Attached Files

  4. #4
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Create VBA Macro to create new rows according to data between Sheet1 and Sheet2

    Try

    Please Login or Register  to view this content.

+ 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: 0
    Last Post: 02-26-2014, 09:57 AM
  2. Take Sheet1 layout and Create Sheet2 layout with Macro
    By theglitch in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-18-2013, 03:50 PM
  3. [SOLVED] Create Special format by copying data from Sheet1 to Sheet2 with conditions using VBA
    By Narasimharao Nandula in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-25-2013, 01:12 AM
  4. [SOLVED] A button to create Sheet2, copy there data from Sheet1 and rename the sheet?
    By mintymike in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-17-2012, 10:34 AM
  5. Replies: 0
    Last Post: 11-15-2012, 09:51 AM

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