①清除單元格中的內容
使用(ClearContents方法)
Sub testClearContents()
MsgBox "清除指定單元格區域中的內容"
Worksheets(9).Range("B1:F8").ClearContents
End Sub
如上代碼功能,第9個工作表的B1:F8這個范圍的數據,就被清除了。
②清除單元格中的格式
使用(ClearFormats方法)
Sub testClearFormats()
MsgBox "清除指定單元格區域中的格式"
Worksheets(9).Range("B1:F8").ClearFormats
End Sub
如上代碼功能,第9個工作表的B1:F8這個范圍的單元格的格式,就被清除了。
?、矍宄龁卧裰械呐?/p>
使用(ClearComments方法)
Sub testClearComments()
MsgBox "清除指定單元格區域中的批注"
Worksheets(9).Range("B1:F8").ClearComments
End Sub
如上代碼功能,第9個工作表的B1:F8這個范圍的單元格的批準,就被清除了。
?、芮宄龁卧裰械娜浚▋热?、格式和批注
使用(Clear方法)
Sub testClear()
MsgBox "徹底清除指定單元格區域"
Worksheets(9).Range("B1:F8").Clear
End Sub
新聞熱點
疑難解答