![]() |
Finding Empty Cells
Hello,
I would like to know if a range contains any blank cells. Is there a shorter method than the one below that simply finds the first occurrence of an empty cell? Thanks. Blank = "No" For Each Cellrge In numtran If IsEmpty(Cellrge) = True Then Blank = "Yes" Exit For End If Next Cellrge |
Finding Empty Cells
If the block of cells is contiguous you can use something similar to the code
below to get a count of blank cells. Sub BlankCells() Dim l As Long Selection.CurrentRegion.Select Selection.SpecialCells(xlCellTypeBlanks).Select l = Selection.Cells.Count If l 0 Then 'Do something here Else 'Do something here End If End Sub -- Kevin Backmann "Bill" wrote: Hello, I would like to know if a range contains any blank cells. Is there a shorter method than the one below that simply finds the first occurrence of an empty cell? Thanks. Blank = "No" For Each Cellrge In numtran If IsEmpty(Cellrge) = True Then Blank = "Yes" Exit For End If Next Cellrge |
Finding Empty Cells
Blank = "No"
On Error Resume Next Set Cellrge = numtran.specialcells(xlCellTypeBlanks) On Error Goto 0 If Not Cellrge Is Nothing Then Blank = "Yes" End If -- HTH Bob Phillips (remove nothere from email address if mailing direct) "Bill" wrote in message k.net... Hello, I would like to know if a range contains any blank cells. Is there a shorter method than the one below that simply finds the first occurrence of an empty cell? Thanks. Blank = "No" For Each Cellrge In numtran If IsEmpty(Cellrge) = True Then Blank = "Yes" Exit For End If Next Cellrge |
All times are GMT +1. The time now is 11:15 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com