Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 89
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,316
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Finding data amongst empty cells James Excel Discussion (Misc queries) 6 November 10th 09 04:35 PM
Finding next empty empty cell in a range of columns UncleBun Excel Programming 1 January 13th 06 11:22 PM
Finding days between cells C and L where the cells may be empty Jack Excel Worksheet Functions 1 January 9th 06 06:47 PM
finding/highlighting empty cells Patrick[_4_] Excel Programming 1 October 1st 03 08:33 AM
Macro trouble finding 'empty' cells foamfollower Excel Programming 1 October 1st 03 02:59 AM


All times are GMT +1. The time now is 12:34 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"