+ Reply to Thread
Results 1 to 7 of 7

Macro to build new sheet in workbook based upon contents of a different sheet in same book

  1. #1
    Registered User
    Join Date
    12-08-2013
    Location
    Ohio
    MS-Off Ver
    Excel 2007
    Posts
    7

    Macro to build new sheet in workbook based upon contents of a different sheet in same book

    Hello! I am need of some help writing a macro. Any help I can receive on this will be GREATLY
    appreciated!

    I have a workbook with 2 sheets: "sizing_feed_data" and "sizing_upload".
    I need a macro that will "read" the data in the "sizing_feed_data" sheet record by record,
    starting with cell 'B1' of the first record. If 'B1' contains a value (numeric), the macro needs
    to copy the value of A1 on this sheet to A1 of the "sizing_upload" sheet, populate B1 and C1 with
    the text 'Size' and D1 with the numeric value of '1' and copy the value that is in cell B1 of the
    "sizing_feed_data" sheet to cell E1 of the "sizing_upload" sheet. The macro then needs to read
    the value of C1 of the first record of the "sizing_feed_data" sheet and if it contains a value it
    needs to create a second row on the "sizing_upload" sheet whose fields are all empty except E2
    which should receive the value of C1 from the "sizing_feed_data" sheet. This process continues
    until the macro finds the first field that is empty (no data) on record 1 of the
    "sizing_feed_data" sheet at which point it "jumps" to record 2 of the "sizing_feed_data" sheet and
    begins the process over, writing to the "sizing_upload" sheet. If it finds no value in B1 it
    jumps immediately to the next row on the "sizing_feed_data" sheet (writing nothing to the
    "sizing_upload" sheet) and begins processing data. This process continues until it comes to the
    end of the data on the "sizing_feed_data" sheet at which time the macro finishes.

    Am I clear on my question? If I too wordy or something, please let me know?

    Much 'thanks' in advance!

    The example below illustrates what I need to do:

    Formatting on the "sizing_feed_data" sheet:

    sizing_feed_data

    A B C D E F G H I J K L M N O P
    115031-100W 4 4.5 5 * * * * * * * * * * * *
    115083-100W 4 4.5 5 5.5 6 6.5 * * * * * * * * *
    115179-W 4 4.5 5 5.5 6 6.5 7 7.5 8 * * * * * *
    117485-W * * * * * * * * * * * * * * *
    411169-10 10 * * * * * * * * * * * * * *
    490684 4 4.5 5 5.5 6 6.5 7 7.5 8 * * * * * *

    Formatting on the "sizing_upload" sheet (how it should look after processing is complete):

    sizing_upload
    A B C D E
    115031-100W Size Size 1 4
    * * * * 4.5
    * * * * 5
    115083-100W Size Size 1 4
    * * * * 4.5
    * * * * 5
    * * * * 5.5
    * * * * 6
    * * * * 6.5
    115179-W Size Size 1 4
    * * * * 4.5
    * * * * 5
    * * * * 5.5
    * * * * 6
    * * * * 6.5
    * * * * 7
    * * * * 7.5
    * * * * 8
    411169-10 Size Size 1 10
    490684 Size Size 1 4
    * * * * 4.5
    * * * * 5
    * * * * 5.5
    * * * * 6
    * * * * 6.5
    * * * * 7
    * * * * 7.5
    * * * * 8
    Last edited by IrishMist1748; 06-28-2014 at 04:16 PM. Reason: removed line numbers from the example tables

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro to build new sheet in workbook based upon contents of a different sheet in same

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    12-08-2013
    Location
    Ohio
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Macro to build new sheet in workbook based upon contents of a different sheet in same

    Thanks for your reply xladept!

    Pleases find the sample before and after tables attached...JB_sizing_table_reformat.xls

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro to build new sheet in workbook based upon contents of a different sheet in same

    Hi Irish,

    Try this:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    12-08-2013
    Location
    Ohio
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Macro to build new sheet in workbook based upon contents of a different sheet in same

    Thank you xladept! This works perfectly! Thank you so much!

  6. #6
    Registered User
    Join Date
    12-08-2013
    Location
    Ohio
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Macro to build new sheet in workbook based upon contents of a different sheet in same

    sizing_table_reformat.xls

    Hello again!

    xladept, how can your macro be modified so it only produces columns for the item number (column A) and the sizes (column B) leaving out the 2 size infos and the 1 on the after page? I tried to make this work but it kept giving me errors
    I have attached the before and after pages as I need it to appear (only the after spread sheet has changed).

    Thank you AGAIN!

    Gary

  7. #7
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro to build new sheet in workbook based upon contents of a different sheet in same

    Hi Gary,

    Try this:

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    12-08-2013
    Location
    Ohio
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Macro to build new sheet in workbook based upon contents of a different sheet in same

    Thanks xladept! This works well! Is it possible to speed both these scripts up somehow? I am processing 11,000+ lines on each (the first one you did and this one as well) and it takes quite a while to process. If not, that is OK, I will just work with them the way they are. At any rate, I really appreciate you helping me out with this 2 scripts!

    Have a GREAT day/night!

    Gary

+ 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. [SOLVED] Move sheet to a new workbook based on D3's contents?
    By poptart141 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 04-04-2013, 02:37 PM
  2. [SOLVED] Trying to build Macro that would print based on contents of cell
    By arndtb in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-28-2013, 04:48 PM
  3. Replies: 4
    Last Post: 06-28-2012, 02:41 PM
  4. Macro to copy sheet from closed work book and overwrite if sheet already exists
    By munkee in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 11-23-2009, 06:36 PM
  5. Replies: 3
    Last Post: 08-23-2008, 06:01 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