M
Michael Beckinsale
Hi,
I have a spreadsheet where l need to call a macro when a particular cell is
changed. There are approx 100 cells (not adjacent) where l need to trigger
the macro. They are all on the same worksheet.
In the following example l have written If statements for 3 of the cells.
Obviously l do not want to write IF statements for all 100 instances.
Can somebody tell me what the code is to effectively list all the cells that
will trigger the IF statement and thus write only 1 IF statement ?
All suggestions warmly received.
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Address(False, False) = "B9" Then
Call AutoFitMergedCellRowHeight
End If
If Target.Address(False, False) = "F9" Then
Call AutoFitMergedCellRowHeight
End If
If Target.Address(False, False) = "B14" Then
Call AutoFitMergedCellRowHeight
End If
End Sub
I have a spreadsheet where l need to call a macro when a particular cell is
changed. There are approx 100 cells (not adjacent) where l need to trigger
the macro. They are all on the same worksheet.
In the following example l have written If statements for 3 of the cells.
Obviously l do not want to write IF statements for all 100 instances.
Can somebody tell me what the code is to effectively list all the cells that
will trigger the IF statement and thus write only 1 IF statement ?
All suggestions warmly received.
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Address(False, False) = "B9" Then
Call AutoFitMergedCellRowHeight
End If
If Target.Address(False, False) = "F9" Then
Call AutoFitMergedCellRowHeight
End If
If Target.Address(False, False) = "B14" Then
Call AutoFitMergedCellRowHeight
End If
End Sub