サイト内のVBAコードを検索できます。
[2008/08/22] Update / by dz02572i
No.[6] セルの削除 |
|
|
ブログトップへ戻る|
|
<--- 一覧へ戻る
[いろいろセルの削除方法]
[セルの値のみを削除]
Sub cLclear1()
'セルの値のみを削除
Selection.ClearContents
End Sub
[セルの値・書式すべてを削除]
Sub cLclear2()
'セルの値・書式すべてを削除
Selection.Clear
End Sub
[A1セルの削除 その1]
Sub cLclear3()
'「A1セル」の削除 1
'選択して削除
Cells(1, "A").Select
Selection.ClearContents
End Sub
[A1セルの削除 その2]
Sub cLclear4()
'「A1セル」の値のみを削除 2
'選択せずに削除
Cells(1, "A").ClearContents
End Sub
[A2からC1の削除 その1]
Sub cLclear5()
'「A2からC1」の削除 1
'選択して削除
Range(Cells(2, "A"), Cells(10, "C")).Select
Selection.ClearContents
End Sub
[A2からC1の削除 その2]
Sub cLclear6()
'「A2からC1」の削除 2
'選択せずに削除
Range(Cells(2, "A"), Cells(10, "C")).ClearContents
End Sub
[A2からC1の削除 その3]
Sub cLclear7()
'「A2からC1」の削除 3
'変数
Dim myRow1 As Long
Dim myRow2 As Long
myRow1 = 2
myRow2 = 10
Range(Cells(myRow1, "A"), Cells(myRow2, "C")).ClearContents
End Sub
[A2からC列の最終行の削除]

Sub cLclear8()
'「A2からC列の最終行」の削除
'変数
Dim myRow1 As Long
Dim myRow2 As Long
myRow1 = 2
myRow2 = Cells(65536, "C").End(xlUp).Row
Range(Cells(myRow1, "A"), Cells(myRow2, "C")).ClearContents
End Sub
サーバーの空き箱に入ってるニャン。甘えん坊ニャン。拍手はちょっとだけすきニャン。

















































































































