0 And Cells(i, "F").Value = "" ThenRange("F2").CopyCells(i, "F").SelectActiveSheet.PasteEnd IfNextEnd Sub■空白の時-Sub 練習()Dim i As LongFor i = 3 To Cells(Rows.Count, "D").End(xlUp).RowIf Cells(i, "D").Value > 0 And Cells(i, "E").Value = "" ThenCells(i, "E").Value = "...">マクロメモ2 | メモブロ-ゲームとガンダムの部屋-
FC2ブログ

マクロメモ2


■空白の時あるセルをコピーペースト
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
































 0

COMMENTS

マクロについて