+ Reply to Thread
Results 1 to 6 of 6

Using loops through sheets

  1. #1
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Using loops through sheets

    Hello everybody
    I have posted a thread about creating Workbooks based on range A2:A6 in sheet named (Main)
    and Mr. Holger ( HaHoBe ) helped me a lot in achieving 70% of my target ..

    The new Workbooks which created contains strings of all values of the range A2:A6
    What I want to do : for example in the Created WB named (Example 1) as a sample to search for the string Example 1 only and delete other strings ... So as the WB to contain only the string Example 1.


    Mr Holger suggested the following but I can't do that task on my own.. He said :

    Use the loop through the sheets and the condition that sheet will not be deleted, add an Autofilter to that sheet, criteria would be in Column 10 as "<>*Example 1*", get the last visible row, use all visible cells in Column J in the range from Row 2 to the last visible row to delete the entire rows, disable Autofilter.


    I appreciate any help
    Attached Files Attached Files

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: Using loops through sheets

    Okay, you have 277 posts over the past 5-1/2 yrs. Eventually somebody has to say, "What the heck man!, are you not learning anything?"
    Why don't you tell us what you have tried to do, and then ask us for help if it didn't work.

  3. #3
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Using loops through sheets

    @dave: 277 posts is nothing. Look up posts by rizmomin. We are his personal business solution team.

    @OP: The solution that HaHoBe gave you is a bit more advanced. There are other ways you can accomplish what you want to do which may be more understandable. I agree with dave when he says don't be afraid to fail on your own. You have to fail before you can get it right.

    HaHoBe's suggestion:
    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Using loops through sheets

    Thank you very much sir for trying to help me
    I can't do anything with this advanced code ..
    I can give my tries in simple code as I am not Professional like you!!

    As for my task the WBs created in Results folder now is two WBs .. The first named (Example 1) it is perfect
    But for (Example 2) the headers in three sheets disappeared!!
    Can we use a nother method ??
    Say to search for the specific string in Range("J2:J" & LR) and to delete these rows that does not contain the string..
    And to count the string after deleting undesired rows .. If it is geater than 0 then everything is ok if it is equal 0 then sheet to be deleted

  5. #5
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Using loops through sheets

    I tried the following part instead of Filter

    Please Login or Register  to view this content.
    But it does not work for me although I tried this part in a nother WB

  6. #6
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Using loops through sheets

    At last I solved it
    it is just a bit line to activate each worksheet

    Please Login or Register  to view this content.
    Thank you very much for all of you who helped me a lot to improve my vba .. Thanks a lot!
    Till we meet again in a nother thread and a nother challenge .. Have a nice time everybody

+ 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. Please help with VBA with loops referencing two sheets. Excel Version 2010
    By EvoLancer in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-16-2014, 11:52 PM
  2. [SOLVED] Loops Through Sheets Starting After SheetX
    By freybe06 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-11-2014, 03:06 PM
  3. macro that loops through a given range of sheets is freezing
    By bkwins in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-21-2013, 12:42 AM
  4. Replies: 0
    Last Post: 01-28-2013, 02:25 PM
  5. Need to change code that loops all sheets TO exclude some sheets.
    By sherrie777 in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 04-10-2010, 05:29 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