ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   determining whether all cells in a row are blank (https://www.excelbanter.com/excel-programming/378351-determining-whether-all-cells-row-blank.html)

rub

determining whether all cells in a row are blank
 
I want to delete rows that have nothing in the cells. How do I
determine whether all cells in a row are blank? Any help would be
greatly appreciated.


Alok

determining whether all cells in a row are blank
 
Hi Rub
Use this function

Public Function IsBlankRow(ByRef ws As Worksheet, ByVal lRow&) As Boolean
Dim c As Range
With ws
For Each c In .Rows(lRow).Cells
If c.Value < "" Then
IsBlankRow = False
Exit Function
End If
Next c
End With
IsBlankRow = True
End Function

You can call it as shown below
Isblankrow(worksheets("Sheet1"),5)
or
IsBlankRow(Sheet1,5)

the second version uses the programmatic name of the sheet and hence does
not need to be enclosed in double quotes.


"rub" wrote:

I want to delete rows that have nothing in the cells. How do I
determine whether all cells in a row are blank? Any help would be
greatly appreciated.



rub

determining whether all cells in a row are blank
 
Thanks. I will try it.


Alok wrote:
Hi Rub
Use this function

Public Function IsBlankRow(ByRef ws As Worksheet, ByVal lRow&) As Boolean
Dim c As Range
With ws
For Each c In .Rows(lRow).Cells
If c.Value < "" Then
IsBlankRow = False
Exit Function
End If
Next c
End With
IsBlankRow = True
End Function

You can call it as shown below
Isblankrow(worksheets("Sheet1"),5)
or
IsBlankRow(Sheet1,5)

the second version uses the programmatic name of the sheet and hence does
not need to be enclosed in double quotes.


"rub" wrote:

I want to delete rows that have nothing in the cells. How do I
determine whether all cells in a row are blank? Any help would be
greatly appreciated.





All times are GMT +1. The time now is 05:30 PM.

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