user4631554
user4631554

Reputation:

One macro for multiple rows of list validations

I searched but couldn't find an answer to what I imagine to be an easy solution. I have multiple rows of list boxes (basically a yes/no questionnaire) and I would like a macro that changes other cells in the same row depending on what is selected from the list in column A. I assume it needs to be a change event and I can do what I want for a single row, but can't figure out how to apply it to the entire column. This is what I have so far:

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

obviously I don't want to hard code each row A3, A4, A5...

Upvotes: 0

Views: 118

Answers (1)

99moorem
99moorem

Reputation: 1983

Try

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

Upvotes: 1

Related Questions