• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Blank Cell (Clear All or Delete Cells) in Excel

Hi i am using the excel 2013

I am trying the blank cells clear all or delete cells Ctrl+Shift+End

We have tried to the selected range (A1:AY337) "Go To Special" select click the Blanks, but not select all blank cells.

And trying based on VBA from https://www.extendoffice.com/documents/excel/2516-excel-warning-if-cell-is-blank.html

Code:
Sub BlackCell()
Dim Rng As Range
Dim WorkRng As Range
On Error Resume Next
xTitleId = "Kutools for Excel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
Set WorkRng = WorkRng.SpecialCells(xlCellTypeBlanks)
If Err = 0 Then
MsgBox "You don't answer all of questions!"
End If
End Sub

I cannot find Blank Cells

Kindly provide the VBA code and Thanks for Advance
 

Attachments

  • Blank Cell (Clear All or Delete Cells).xlsm
    101.9 KB · Views: 5
Last edited by a moderator:
Many blank cells aren't blank but contain a zero-length string.
If the range you select is contiguous you can use:
Code:
Sub BlankCell()
Dim WorkRng As Range
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", , WorkRng.Address, Type:=8)
If Application.WorksheetFunction.CountBlank(WorkRng) <> 0 Then MsgBox "blank cell(s) found"
End Sub
If ever you might select a non-countiguous range then:
Code:
Sub BlankCell2()
Dim WorkRng As Range
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", , WorkRng.Address, Type:=8)
For Each are In WorkRng.Areas
  If Application.WorksheetFunction.CountBlank(are) <> 0 Then
    MsgBox "blank cell(s) found"
    Exit For
  End If
Next are
End Sub
 
Back
Top