+ Reply to Thread
Results 1 to 7 of 7

Cleaning multiple sheets of data for creating one sheet to be used as pivot source

  1. #1
    Forum Contributor
    Join Date
    11-11-2012
    Location
    Muscat, Oman
    MS-Off Ver
    Office 365
    Posts
    522

    Cleaning multiple sheets of data for creating one sheet to be used as pivot source

    Hello Experts,

    Every month I get a workbook with multiple sheets in raw format which requires a lot of time clean and get it in one sheet to be used as pivot table data source.
    With the help of some experts I have tried to build a code which will

    1. Unmerge all the merged cells in all the work sheets (Coz some cells in all the sheets are merged)
    2. Find all the worksheets name containing SMRY or SUMMARY and delete
    3. In column A of all the remaining worksheets find string AAA & delete all the rows including AAA and above
    4. In column A of all the remaining worksheets find string BBB & delete all the rows including BBB and below

    But the code below is giving me runtime error.

    Besides above I would also like to add a column where it adds the sheet name in each row.

    Please advise/help.

    Best Regards/VKS
    Please Login or Register  to view this content.
    Last edited by VKS; 02-08-2014 at 03:00 AM. Reason: correction in point 2

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,861

    Re: Cleaning multiple sheets of data for creating one sheet to be used as pivot source

    first:

    remove
    Please Login or Register  to view this content.
    from the beginning of sub

    then rewritted code for cleaning above AAA and below BBB could look like:

    Please Login or Register  to view this content.
    PS. If the code stops with error always let us know the error message and in which line it stops. Posting a (sample - no delicate data and not too big one) workbook is always a good idea.
    Last edited by Kaper; 02-08-2014 at 02:42 AM.
    Best Regards,

    Kaper

  3. #3
    Forum Contributor
    Join Date
    11-11-2012
    Location
    Muscat, Oman
    MS-Off Ver
    Office 365
    Posts
    522

    Re: Cleaning multiple sheets of data for creating one sheet to be used as pivot source

    Thanks a lot for your help Kaper.
    I got the run time error 424 and code stopped at
    Please Login or Register  to view this content.
    Best Regards/VKS

  4. #4
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,861

    Re: Cleaning multiple sheets of data for creating one sheet to be used as pivot source

    obviously a typo. myramge makes no sense :-) change to myrange
    Please Login or Register  to view this content.
    as there was no sample file attached (see forum rules) - all corrections were just written in forum editor and not tested :-)

  5. #5
    Forum Contributor
    Join Date
    11-11-2012
    Location
    Muscat, Oman
    MS-Off Ver
    Office 365
    Posts
    522

    Re: Cleaning multiple sheets of data for creating one sheet to be used as pivot source

    Sorry Kaper,
    Running the code after editing the typos deleted all data from the first sheet after deleting smry sheets.
    It didn't run on any other worksheet.
    Best Regards/VKS

  6. #6
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,861

    Re: Cleaning multiple sheets of data for creating one sheet to be used as pivot source

    let me autoquote myself:
    "Posting a (sample - no delicate data and not too big one) workbook is always a good idea."
    Otherwise I have no chance to check what happens (May be you have AAA or BBB more than once in a sheet or BBB above AAA or ... or ??? anything)

    Of course you can debug it yourself. In editor do step-in (F8) and observe values in Locals window (or setup some watches) and changes your workbook.

  7. #7
    Forum Contributor
    Join Date
    11-11-2012
    Location
    Muscat, Oman
    MS-Off Ver
    Office 365
    Posts
    522

    Re: Cleaning multiple sheets of data for creating one sheet to be used as pivot source

    Thanks for your advise Kaper...... Will try with editor first and if I get stuck will request for your help with a sample sheet.
    Best Regards/VKS

+ 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. Cleaning multiple sheets for a Pivot Table
    By VKS in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-16-2013, 09:37 AM
  2. Create log sheet from multiple source sheets
    By nlee in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-10-2012, 05:48 PM
  3. Update Data in Multiple Sheets From 1 Source Sheet
    By smfismfi in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-11-2012, 04:17 PM
  4. creating multiple sheet reports from main data source
    By Kolacube in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-03-2011, 10:22 AM
  5. Creating multiple sheets from data in 1 sheet
    By dhbyrne in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-16-2007, 06:42 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