我进行了搜索,但找不到我想象的简单解决方案的答案。我有多行列表框(基本上是一个是/否调查表),并且我想要一个宏,它根据从A列中的列表中选择的内容来更改同一行中的其他单元格。我认为它需要是一个更改事件而且我可以为单行做我想做的事,但无法弄清楚如何将其应用于整个列。这是我到目前为止所拥有的:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(True, True) = "A2" Then
Select Case Target
Case "list option one"
call Macro1
Case "list option 2"
'Call Macro2
Case Else
'Do nothing
End Select
End If
End Sub
显然我不想对A3,A4,A5每行进行硬编码...
尝试
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 Then
If Target.Value = True Then 'If target = true (This can be what ever you want)
Cells(Target.Row, 2).Value = True 'Then put true on same row but column 2 e.g. B
End If
End If
End Sub
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句