+ Reply to Thread
Results 1 to 8 of 8

Repeat a process on all visible sheets then combine

  1. #1
    Forum Contributor PY_'s Avatar
    Join Date
    09-23-2008
    Location
    Houston
    MS-Off Ver
    Office 2016
    Posts
    289

    Repeat a process on all visible sheets then combine

    I hope this makes some sort of sense:

    I have a few lines of code that i need to repeat on all visible sheets of a workbook. The number of sheets and names of sheets will vary on a job by job basis but the cell locations do not change.

    Here is what i am trying to repeat:

    Please Login or Register  to view this content.


    After repeating the above on all sheets, i want to combine the values (using Paste:=xlPasteValues) of (BI10:DA21) from all visible sheets to a sheet called CSV_Export starting at A5 on that sheet and repeating doward till all visible sheets have been copied to that sheet. I have no idea of how to make it repeat on visible sheets.
    Last edited by PY_; 08-31-2010 at 12:49 PM.

  2. #2
    Forum Contributor PY_'s Avatar
    Join Date
    09-23-2008
    Location
    Houston
    MS-Off Ver
    Office 2016
    Posts
    289

    Re: Repeat a process on all visible sheets then combine

    I found a way to repeat the process on all sheets using the following:


    Please Login or Register  to view this content.

    I am just about finished now with this project. Only problem i am facing now is that i need to shift all the data upwards by removing all the rows containing blanks. For some reason, after pasting the values of multiple sheets into my CSV_Export sheet tab, when i try to select the blank cells, it says the cells i copied and pasted from previous sheets are not blank. Although visually they are blank and they do not have spaces in them. The codes inside those cells return a "" if the IF command isnt true.

    Currently, if I CTRL+SHIFT+DOWN to the bottom of the sheet, it acts like i have data down to row 88. But i really only have 7 rows containing data after i remove the blank rows manually.
    Last edited by PY_; 08-27-2010 at 10:48 AM.

  3. #3
    Forum Contributor PY_'s Avatar
    Join Date
    09-23-2008
    Location
    Houston
    MS-Off Ver
    Office 2016
    Posts
    289

    Re: Repeat a process on all visible sheets then combine

    I ended up changing the IF statement to return a specific text instead of "". Then did a search for that specific text in Column A and deleted the entire row that containied that specific text in the first cell.

  4. #4
    Forum Contributor PY_'s Avatar
    Join Date
    09-23-2008
    Location
    Houston
    MS-Off Ver
    Office 2016
    Posts
    289

    Re: Repeat a process on all visible sheets then combine

    I thought it worked but it does not. It goes through ALL sheets whether they are visible or not. So i am back to square one.

    Does anyone have a way to "Call Copy_Sort" on the first visible sheet and continue through all visible sheets and stop after running it on the last sheet?

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Repeat a process on all visible sheets then combine

    You must feel like you hear the sound of one hand clapping ...

    Post a workbook that illustrates the problem and explain in context.
    Entia non sunt multiplicanda sine necessitate

  6. #6
    Forum Contributor PY_'s Avatar
    Join Date
    09-23-2008
    Location
    Houston
    MS-Off Ver
    Office 2016
    Posts
    289

    Re: Repeat a process on all visible sheets then combine

    Here is my example.
    Attached Files Attached Files

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Repeat a process on all visible sheets then combine

    Your copy/sort routine is completely different so I can't tell if this does what you want, but it does test for sheet visibility:

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor PY_'s Avatar
    Join Date
    09-23-2008
    Location
    Houston
    MS-Off Ver
    Office 2016
    Posts
    289

    Re: Repeat a process on all visible sheets then combine

    The test for sheet visibliity portion is perfect.

    The cleaned up version is much better as well. Ill take that and run with it.

    Thank you shg!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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