自衛隊

code

Dim book1 As Workbook

Set book1 = Workbooks("Book1.xlsx")

 html
 
 
Sub 数値がゼロの行を削除()
Dim i As Long
Dim LastRow As Long
'最終行を取得
LastRow = Cells(Rows.Count, 1).End(xlUp).Row
'行を逆順にループ
For i = LastRow To 1 Step -1
If Cells(i, 2).Value = 0 Then
'行削除
Rows(i).Delete
End If
Next i
End Sub

-自衛隊

Copyright© hyakublog , 2024 All Rights Reserved Powered by AFFINGER5.