ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to delete rows (https://www.excelbanter.com/excel-programming/297881-re-macro-delete-rows.html)

Charley

Macro to delete rows
 

-----Original Message-----
I was hoping to create a VBA function that would identify

empty or blank cells within a range, and then delete the
row associated with that empty or blank cell.

Can anyone provide some help?

Thanks!
.

here a macro:
Sub Macro1()
Dim x As Integer
Dim y As Integer
Dim x1 As Integer

x = "Row Start"
For x1 = "Row Start" To "Row end"
If Len(Cells(x, 5)) = 0 Then '"Column for blank"
exmple a = 1, c = 3
Rows(x).Select
Rows(x).Delete
x = x - 1 'You just delete a line, so need to
back up
End If

x = x + 1
Next x1
End Sub


All times are GMT +1. The time now is 08:09 PM.

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