+ Reply to Thread
Results 1 to 14 of 14

Macro to created Database from a Table Matrix on All Sheets in a Workbook

  1. #1
    Forum Contributor
    Join Date
    12-26-2015
    Location
    UAE
    MS-Off Ver
    2013
    Posts
    128

    Macro to created Database from a Table Matrix on All Sheets in a Workbook

    Hello All,

    I am using Excel 2013 and have a workbook with100+ sheets.

    All sheets are table with different size and dimensions.

    I am attaching a sample data with the problem and the expected result I want through a macro.

    Data starts in from Row 1 across and down with Headers in Row 1 The macro should run on all the sheet and create the output below each table leaving a gap of 4 rows as shown in the attached sample and colored for explanation purpose only.

    If the cells are blank or zero, then it should not pull that data in the database.

    Kindly note that the number of Headings may vary from sheet to sheet as well as the Product number.

    In the sample I have shown Headings 1 to 15. Col A will always be Product and Last Column will always be Tag in Row 1.

    Product number will also vary from Product 1 to Product N. In the sample I have shown Product 1 to Product 15.

    Any help would be greatly appreciated.

    Thanks in advance
    Attached Files Attached Files
    Last edited by rehana402003; 06-13-2022 at 02:52 PM.

  2. #2
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,230

    Re: Macro to created Database from a Table Matrix on All Sheets in a Workbook

    Please Login or Register  to view this content.
    Last edited by sintek; 06-09-2022 at 08:40 AM.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,879

    Re: Macro to created Database from a Table Matrix on All Sheets in a Workbook

    Power Query solution. Unpivot your data, filter out the zero values.

    Please Login or Register  to view this content.
    Power Query is a free AddIn for Excel 2010 and 2013, and is built-in functionality from Excel 2016 onwards (where it is referred to as "Get & Transform Data").

    It is a powerful yet simple way of getting, changing and using data from a broad variety of sources, creating steps which may be easily repeated and refreshed. I strongly recommend learning how to use Power Query - it's among the most powerful functionalities of Excel.

    - Follow this link to learn how to install Power Query in Excel 2010 / 2013.

    - Follow this link for an introduction to Power Query functionality.

    - Follow this link for a video which demonstrates how to use Power Query code provided.
    Attached Files Attached Files
    Last edited by alansidman; 06-09-2022 at 08:59 AM.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  4. #4
    Registered User
    Join Date
    03-13-2021
    Location
    Bombarral, Portugal
    MS-Off Ver
    365
    Posts
    1

    Re: Macro to created Database from a Table Matrix on All Sheets in a Workbook

    Try this:

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    12-26-2015
    Location
    UAE
    MS-Off Ver
    2013
    Posts
    128

    Re: Macro to created Database from a Table Matrix on All Sheets in a Workbook

    Thanks Sintek, works great.

  6. #6
    Forum Contributor
    Join Date
    12-26-2015
    Location
    UAE
    MS-Off Ver
    2013
    Posts
    128

    Re: Macro to created Database from a Table Matrix on All Sheets in a Workbook

    Hi there,
    Your macro also pulls up value which is zero.
    OP I had mentioned that zero value or blank should not be populated in the database.
    Thanks for your time.

  7. #7
    Forum Contributor
    Join Date
    12-26-2015
    Location
    UAE
    MS-Off Ver
    2013
    Posts
    128

    Re: Macro to created Database from a Table Matrix on All Sheets in a Workbook

    Hello Alan,
    Your solution is perfect but I don't know how will I be able to run on 100+ sheets. I will have run it individually on each seperate sheet?
    Thanks for your time and help.

  8. #8
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,230

    Re: Macro to created Database from a Table Matrix on All Sheets in a Workbook

    Glad to have helped...Tx for rep +

  9. #9
    Forum Contributor
    Join Date
    12-26-2015
    Location
    UAE
    MS-Off Ver
    2013
    Posts
    128

    Re: Macro to created Database from a Table Matrix on All Sheets in a Workbook

    Hello Sintek,
    One small request please, would it possible to change your code to display the Sheet name in Col A and then all other Headings as shown in the V1 attachment.
    Thanks once again for your time and help.
    Attached Files Attached Files

  10. #10
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,230

    Re: Macro to created Database from a Table Matrix on All Sheets in a Workbook

    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    12-26-2015
    Location
    UAE
    MS-Off Ver
    2013
    Posts
    128

    Re: Macro to created Database from a Table Matrix on All Sheets in a Workbook

    Thanks Sintek,
    I will test it with my actual data when I return to work next week.

  12. #12
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,879

    Re: Macro to created Database from a Table Matrix on All Sheets in a Workbook

    You could run a VBA loop to initiate the Query.

  13. #13
    Forum Contributor
    Join Date
    12-26-2015
    Location
    UAE
    MS-Off Ver
    2013
    Posts
    128

    Re: Macro to created Database from a Table Matrix on All Sheets in a Workbook

    Dear Alan,
    You are right, I am not aware of how to do it.
    Thanks for your time and help

  14. #14
    Forum Contributor
    Join Date
    12-26-2015
    Location
    UAE
    MS-Off Ver
    2013
    Posts
    128

    Re: Macro to created Database from a Table Matrix on All Sheets in a Workbook

    Dear All,
    Thanks to everyone for their time and help.

+ 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] VBA Macro to create pivot table of all sheets of a workbook
    By mfhaq77 in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 12-30-2021, 05:30 PM
  2. Run a macro with a command button in a new workbook that is created from another workbook.
    By seattletimebandit in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-08-2018, 11:58 PM
  3. Repost - Macro to convert flat database to a Database from two sheets
    By rehana402003 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-12-2017, 05:02 AM
  4. bringing 2 sheets (at the end of workbook) to the Same newly created workbook
    By swade730 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-16-2015, 07:10 AM
  5. Pivot Table(s) update macro workbook with locked sheets
    By torers in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-13-2015, 12:49 PM
  6. Need Macro for Deleting sheets already created
    By srinivasan1965 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-03-2015, 12:14 AM
  7. Extra Sheets Created After I Run Macro
    By nuttycongo123 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-13-2011, 08:43 AM

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