activexcheckbox循环select链接的单元格偏移量,然后复制行

我有大约50个checkbox全部链接到它们所在的单元格(例如A2中的checkbox链接到单元格A2)。 我有循环在一定程度上工作。 我遇到的问题是使链接的单元格被选中,偏移量为1的单元格,然后复制该行从链接的单元格中删除。 然后粘贴到不同的工作表到下一个空白行。

Sub CheckboxLoop() Dim objx As OLEObject Dim lastrow As Range Application.ScreenUpdating = False 'Loop through Checkboxes With ActiveSheet For Each objx In .OLEObjects If TypeName(objx.Object) = "CheckBox" Then If objx.Object.Value = True Then If objx.Object.LinkedCell = True Then 'runtime error 438 object doesn't support this property or method objx.Object.LinkedCell.Offset(0, 1).Select Range(Cells(Selection.Row, 1), Cells(Selection.Row, 3)).Select Selection.Copy Worksheet("Data").Select Worksheet("Data").Range("A1").End(xlDown).Offset(1, 0).Select Selection.PasteSpecial (xlPasteValues) Application.CutCopyMode = False End If ElseIf objx.Object.Value = False Then ElseIf IsNull(objx.Object.Value) Then End If End If Next End With Application.ScreenUpdating = True End Sub 

当我通过macros一切都很好,直到我到第三如果我收到运行时错误438对象不支持此属性或方法

任何帮助将是非常感谢

LinkedCell属性是Stringtypes,用于存储/检索链接到combobox的单元格的地址

所以你想用

  If objx.LinkedCell <>"" Then .Range(objx.LinkedCell).Offset(0, 1).Select '... rest of your code End If