我有代码可以删除某个单元格中的复选框,但我需要它来删除我选择的范围内的所有复选框。以下是我删除某个单元格中的复选框的代码。
Columns("B:B").Select
Selection.Find(What:="FIELD SERVICES", After:=ActiveCell, LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Offset(1, -1).Select
Dim CB8 As CheckBox
For Each CB8 In ActiveSheet.CheckBoxes
If CB8.TopLeftCell.Address = ActiveCell.Address Then CB8.Delete
Next
以下是我如何尝试更改它以删除我需要的范围内的单元格,但它只删除范围的第一个单元格中的复选框。
Columns("B:B").Select
Selection.Find(What:="FIELD SERVICES", After:=ActiveCell, LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False).Activate
Range(ActiveCell.Offset(1, -1), ActiveCell.Offset(8, 0).Select
Dim CB8 As CheckBox
For Each CB8 In ActiveSheet.CheckBoxes
If CB8.TopLeftCell.Address = ActiveCell.Address Then CB8.Delete
Next
任何意见是极大的赞赏。