因爲你沒有提到什麼樣的控制是它(ActiveX或窗體控件),你挑
表對照實施例
Sub FormControl_Example()
Dim shp As Shape
Dim rng As Range, rngShp As Range
With ThisWorkbook.Sheets("Sheet1") '<~~ Change this to the relevant sheet name
Set rng = .Range("D12:D14")
For Each shp In .Shapes
Set rngShp = .Range(shp.TopLeftCell.Address)
If Not Intersect(rngShp, rng) Is Nothing Then
shp.OLEFormat.Object.Value = True
End If
Next
End With
End Sub
ActiveX控件實施例
Sub ActiveX_Example()
Dim shp As Shape
Dim rng As Range, rngShp As Range
With ThisWorkbook.Sheets("Sheet1") '<~~ Change this to the relevant sheetname
Set rng = .Range("D12:D14")
For Each shp In .Shapes
Set rngShp = .Range(shp.TopLeftCell.Address)
If Not Intersect(rngShp, rng) Is Nothing Then
.OLEObjects(shp.Name).Object.Value = True
End If
Next
End With
End Sub
它們是什麼類型的複選框 - 表單或ActiveX? –