+ Reply to Thread
Results 1 to 19 of 19

Msgbox all empty rows in a range

Hybrid View

  1. #1
    Valued Forum Contributor
    Join Date
    08-10-2012
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    721

    Re: Msgbox all empty rows in a range

    Olly - that works great, but only if there are blank rows to find. - how do you change it so that it doesnt crash if there are NO blank cells?

    Nathansav - I get a syntax error on the line
          s=s& c.row & ","

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Msgbox all empty rows in a range

    Quote Originally Posted by nickmax1 View Post
    Olly - that works great, but only if there are blank rows to find. - how do you change it so that it doesnt crash if there are NO blank cells?
    Adding a bit of error handling:
    Sub foo()
        Dim r As Range
        On Error GoTo NoBlanks
        Set r = Range("B18:B" & Range("B191").End(xlUp).Row).SpecialCells(xlCellTypeBlanks)
        MsgBox "Blank cells in " & Replace(r.Address(False, False), "B", ""), vbInformation + vbOKOnly, "Blanks"
        Exit Sub
    NoBlanks:
        MsgBox "No blank cells found", vbInformation + vbOKOnly, "Blanks"
    End Sub
    Also tweaked to return just the rows, not the full cell addresses.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

+ 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. Need help deleting empty rows from a range from the bottom of the list up
    By pasqualebaldi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-16-2014, 07:48 PM
  2. Display msgbox if two cells in range are not empty
    By loroverde in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-13-2014, 12:49 AM
  3. [SOLVED] Delete empty rows in range after last used row
    By crakter in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-26-2013, 12:30 PM
  4. Msgbox - when cell is empty
    By KA_Analyst in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-15-2007, 04:36 PM
  5. empty rows in range
    By רוזנט in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-05-2006, 05:10 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