+ Reply to Thread
Results 1 to 9 of 9

Check during loop if page is empty??

  1. #1
    Registered User
    Join Date
    08-21-2013
    Location
    New Zealand
    MS-Off Ver
    Excel 2016
    Posts
    81

    Check during loop if page is empty??

    Hi guys

    Is there anyway to skip to the next sheet if the PAGE is EMPTY??

    At the moment if the page is empty it crashes

    Please Login or Register  to view this content.

  2. #2
    Forum Contributor
    Join Date
    02-09-2009
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    282

    Re: Check during loop if page is empty??

    Hi Exodus, many threads out there on this:

    https://www.mrexcel.com/forum/excel-...blank-vba.html

    https://www.ozgrid.com/forum/forum/h...sheet-is-empty

  3. #3
    Registered User
    Join Date
    08-21-2013
    Location
    New Zealand
    MS-Off Ver
    Excel 2016
    Posts
    81

    Re: Check during loop if page is empty??

    If I add in "If Sheet1.Range("a1").Cells.Value = False Then"

    How do I make it go "Next X" without running the rest of the code for that current x

  4. #4
    Forum Contributor
    Join Date
    02-09-2009
    Location
    London
    MS-Off Ver
    Excel 2016
    Posts
    282

    Re: Check during loop if page is empty??

    By a nested loop outside (as the parent) of the current block. I think you'll get more responses if you put a bit more detail and upload a worksheet.

    You could go to the next X but you're going to run into problems later, you have:

    Please Login or Register  to view this content.
    I think it's possible you could run into a Chart, or other object in the Sheets collection and you may run into problems with loop counters not matching up and your procedure could run out of range.

    https://www.safaribooksonline.com/li...3/ch04s03.html

  5. #5
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham
    MS-Off Ver
    365
    Posts
    8,735

    Re: Check during loop if page is empty??

    How about
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    08-21-2013
    Location
    New Zealand
    MS-Off Ver
    Excel 2016
    Posts
    81

    Re: Check during loop if page is empty??

    Hi

    Have posted a sample of the data

    Pages a to f are not in use in this example

    Only page 1 to 13

    I believe my code crashes on page 7 (Which once it deletes the top 49 rows it blank)
    Attached Files Attached Files

  7. #7
    Forum Expert
    Join Date
    10-06-2017
    Location
    drevni ruchadlo
    MS-Off Ver
    old
    Posts
    1,726

    Re: Check during loop if page is empty??

    Use Fluff13 variant, but with 'Rows', i.e. "If .Range("A1").CurrentRegion.Rows.Count > 1 Then"

    or maybe this way without "If .Range("A1").CurrentRegion.Rows.Count > 0 Then"

    Please Login or Register  to view this content.
    Last edited by porucha vevrku; 04-29-2018 at 12:28 AM.

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013
    Posts
    17,146

    Re: Check during loop if page is empty??

    Change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    08-21-2013
    Location
    New Zealand
    MS-Off Ver
    Excel 2016
    Posts
    81

    Re: Check during loop if page is empty??

    Quote Originally Posted by jindon View Post
    Change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    Thank you :D

+ 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] Check if value is in range, and if so check cell on row empty
    By tool_fairy in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-21-2017, 10:35 AM
  2. [SOLVED] need snippet to check two cells and paste into them if empty. if neither is empty, next i
    By Royzer in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-09-2016, 07:17 PM
  3. Empty cells not evaluating as empty - multiple check methods tried
    By rafadavidc in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 02-03-2014, 05:54 PM
  4. [SOLVED] Error check and if the cell is not numeric or empty loop to the next item
    By JamesGoulding85 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 07-23-2013, 10:47 AM
  5. [SOLVED] How to write loop to check for empty cells
    By JaydenK in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-22-2013, 09:17 AM
  6. Replies: 1
    Last Post: 12-14-2012, 10:11 AM
  7. Replies: 0
    Last Post: 07-20-2010, 11:42 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