özellikle data sayfası olarak kullandığımız Excel sayfalarında satır tamamen boş ise son eklediğim kod ile sayfa ismini girerek satırı silebiliyoruz (daha denemedim)
@benbendedeilem
Function XLBlank()
For Each sh In ActiveWorkbook.Worksheets
sh.Activate
Cells(1, 1).Select
lRow = Cells.Find(What:="*", _
After:=Range("A1"), _
LookAt:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
Range("A" & lRow + 1, Range("A1").SpecialCells(xlCellTypeLastCell).Address).Select
On Error Resume Next
Selection.EntireRow.SpecialCells(xlBlanks).EntireRow.Delete
Cells(1, 1).Select
ActiveWorkbook.Save
Next
ActiveWorkbook.Worksheets(1).Activate
ActiveWorkbook.Save
End Function
Sub delete_rows_blank2()
t = 1
lastrow = ActiveSheet.UsedRange.Rows.Count
lastcol = ActiveSheet.UsedRange.Columns.Count
Do Until t = lastrow
For j = 1 To lastcol
'This only checks the first column because the "Else" statement below will skip to the next row if the first column has content.
If Cells(t, j) = "" Then
j = j + 1
If j = lastcol Then
Rows(t).Delete
t = t + 1
End If
Else
'Note that doing this row skip, may prevent user from checking other columns for blanks.
t = t + 1
End If
Next
Loop
End Sub
(14/01/2020, 12:40)accessman yazdı: 5. mesajda eklediğim kod gayet güzel çalışıyor. Herhangi bir modüle ekleyin
Call DeleteBlankRows
diyerek kullanın
Range("A2:D500").SpecialCells(xlCellTypeBlanks).select