Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help to simplify code.
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can I simplify a VB code?????? | Excel Discussion (Misc queries) | |||
I need to simplify this... | Excel Worksheet Functions | |||
Simplify code | Excel Worksheet Functions | |||
Need to simplify code | Excel Discussion (Misc queries) | |||
simplify code | Excel Discussion (Misc queries) |