Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Worksheet - Test for Blank - No/Null Data 1

Status
Not open for further replies.

hafod

Technical User
Mar 14, 2005
73
GB
Hi,
Is there a simple way of determining whether a spreadsheet worksheet contains no data values, labels etc (ie Is literally BLANK!). I suspect you could test a specific cell or a range of cells, but is there a more elegant way in Excel' s object model to achieve this, I have tried using knowledge base but no specific suggestions. Having being able to do this, I can issue a user message and exit the user forms validation routine (gracefully!).
Thanks in anticipation,
Mike (Hafod)
 
Something like this ?
If Worksheets(1).UsedRange.Cells.Count = 1 _
And Trim(Worksheets(1).Cells.SpecialCells(xlCellTypeLastCell)) = "" Then
MsgBox Worksheets(1).Name & " is empty"
End If


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top