Thread
:
Delete Table row with first cell not empty
View Single Post
#
3
Posted to microsoft.public.excel.programming
Charabeuh[_4_]
external usenet poster
Posts: 62
Delete Table row with first cell not empty
read
the first macro finds the empty row (col B to col E) from which all other
rows are empty.
Then deletes all rows from this first empty row to row 100
instead of
the first macro finds the first empty row (col B to col E) and deletes all
rows from this first empty row to row 100
"Charabeuh" a écrit dans le message de groupe de
discussion :
...
2 macros:
the first macro finds the first empty row (col B to col E) and deletes all
rows from this first empty row to row 100
the 2nd macro delete rows ( row by row ) skipping rows that are not empty
(col B to col E) from row 6 to row 100
Option Explicit
Public Sub deleteEmptyRows()
Dim RowMin, I, J
'Find the line from which to delete
RowMin = 6
With ActiveSheet
For I = 2 To 5
J = 1 + Cells(101, I).End(xlUp).Row
RowMin = Application.WorksheetFunction.Max(J, RowMin)
Next I
If RowMin <= 100 Then Range("A" & RowMin & ":E100").ClearContents
End With
End Sub
Public Sub deleteEmptyRows2()
Dim I, NbrNotEmpty
With ActiveSheet
For I = 6 To 100
NbrNotEmpty = Application.WorksheetFunction.CountA(Range("B" & I & ":E"
& I))
If NbrNotEmpty = 0 Then Range("A" & I).ClearContents
Next I
End With
End Sub
"GBExcel via OfficeKB.com" <u55438@uwe a écrit dans le message de groupe
de discussion : a1d823bed10f9@uwe...
Hi,
I need a macro to do the following:
I have a table like this, starting in row 6.
] ] A B C D E
6] 1 N N N
7] 2 N N N N
8] 3 N N N N
9] 4
10]5
11]
12]
13]
etc.
100]
Rows 11 to 100 are empty.
I want to select area A1:E100 and delete all content from table rows
A9:E9
and A10:E10, because these table rows have empty cells from columns B
through
to E. The rows are marked by an ID number as in numbers 1 to 5 above.
When
cells in columns B to E are found to be empty, the content of the table
row,
including the row ID, must be deleted. Note, this is not deleting the
entire
excel row, just the content of rows 9 and 10 or down.
Appreciate the help.
GBExcel
--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/201001/1
Reply With Quote
Charabeuh[_4_]
View Public Profile
Find all posts by Charabeuh[_4_]