ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   check a range of cells to see if they are empty (https://www.excelbanter.com/excel-programming/357086-check-range-cells-see-if-they-empty.html)

L3Tech

check a range of cells to see if they are empty
 
I am looking for code that will check a range of cells to see if they
contain any data. If they do, then I know the sheet has been used before
and it is not the first time it is being used.


bttman

check a range of cells to see if they are empty
 
This function returns true if range provided as argument is truly empty
(no spaces, formulas, etc).


Function range_empty(rng As Range) As Boolean
Dim cell As Range
range_empty = True
For Each cell In rng
If cell.Formula < "" Then
range_empty = False
Exit For
End If
Next
End Function



All times are GMT +1. The time now is 06:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com