+ Reply to Thread
Results 1 to 3 of 3

Looping through various worksheets VBA

  1. #1
    Registered User
    Join Date
    10-04-2023
    Location
    Scotland
    MS-Off Ver
    Office 365
    Posts
    3

    Question Looping through various worksheets VBA

    Hello,

    I am looking to create a loop to run through all the worksheets in my workbook to run some code that clears the contents of "blank cells".

    The code works for the active worksheet but doesn't seem to run through the loop to the next one.

    Please Login or Register  to view this content.

    Thanks for any help

    Matt

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Looping through various worksheets VBA

    It is because you are not addressing each ws, you are looping through them, but RemoveBlanks works on the active sheet, which is always the same. 2 solutions:

    Please Login or Register  to view this content.
    Or, just have removeBlanks actually work on the sheet in question:

    Please Login or Register  to view this content.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Looping through various worksheets VBA

    Hi there,

    See if the following code does what you need:

    Please Login or Register  to view this content.

    Hope this helps - please let me know how you get on.

    Regards,

    Greg M

+ 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] Help Looping through All Worksheets
    By DPeter2101 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-12-2016, 01:41 PM
  2. looping through worksheets except
    By bjcowen9000 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-19-2015, 03:09 PM
  3. [SOLVED] Looping through worksheets
    By The Phil in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-19-2014, 10:21 AM
  4. Looping through worksheets
    By terkel in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-25-2008, 03:54 AM
  5. [SOLVED] Looping through Worksheets
    By Steve in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-12-2005, 03:05 PM
  6. Looping across worksheets
    By Ramthebuffs in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-19-2005, 12:52 AM
  7. [SOLVED] Looping through Worksheets
    By Kirk P. in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-07-2005, 02:06 PM

Tags for this Thread

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