マクロメモ2
2022/12/25
0
■空白の時あるセルをコピーペースト
Sub 練習()
Dim i As Long
For i = 3 To Cells(Rows.Count, "D").End(xlUp).Row
If Cells(i, "D").Value > 0 And Cells(i, "F").Value = "" Then
Range("F2").Copy
Cells(i, "F").Select
ActiveSheet.Paste
End If
Next
End Sub
■空白の時-
Sub 練習()
Dim i As Long
For i = 3 To Cells(Rows.Count, "D").End(xlUp).Row
If Cells(i, "D").Value > 0 And Cells(i, "E").Value = "" Then
Cells(i, "E").Value = "-"
End If
Next
End Sub
■行削除
Sub 練習3()
Dim i As Long
For i = 3 To Cells(Rows.Count, "D").End(xlUp).Row
If Cells(i, "D").Value = "" Then
Rows(i).Delete
End If
Next
End Sub
Sub 練習4()
Range("D3:D10000").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End Sub













