①清除單元格中的內(nèi)容
使用(ClearContents方法)
Sub testClearContents()
MsgBox "清除指定單元格區(qū)域中的內(nèi)容"
Worksheets(9).Range("B1:F8").ClearContents
End Sub
如上代碼功能,第9個工作表的B1:F8這個范圍的數(shù)據(jù),就被清除了。
②清除單元格中的格式
使用(ClearFormats方法)
Sub testClearFormats()
MsgBox "清除指定單元格區(qū)域中的格式"
Worksheets(9).Range("B1:F8").ClearFormats
End Sub
如上代碼功能,第9個工作表的B1:F8這個范圍的單元格的格式,就被清除了。
③清除單元格中的批注
使用(ClearComments方法)
Sub testClearComments()
MsgBox "清除指定單元格區(qū)域中的批注"
Worksheets(9).Range("B1:F8").ClearComments
End Sub
如上代碼功能,第9個工作表的B1:F8這個范圍的單元格的批準,就被清除了。
④清除單元格中的全部,包括內(nèi)容、格式和批注
使用(Clear方法)
Sub testClear()
MsgBox "徹底清除指定單元格區(qū)域"
Worksheets(9).Range("B1:F8").Clear
End Sub
新聞熱點
疑難解答
圖片精選