vba 清除本sheet所有单元格内容和清除所有sheet中所有单元格

Excel vba 清除本sheet所有单元格内容和清除所有sheet中所有单元格的代码分别怎么写?

Excel vba 清除本sheet所有单元格内容和清除所有sheet中所有单元格的代码分别怎么写?

1

2

3

4

5

6

7

8

9

10

Public Sub 清除本工作表()

    Worksheets("sheet1").UsedRange.ClearContents

End Sub

Public Sub 清除所有表()

    Dim WS As Worksheet

    For Each WS In Worksheets

        WS.UsedRange.ClearContents

    Next

End Sub

原文地址:https://www.cnblogs.com/grj001/p/12225431.html