Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I simplify a VB code?????? hoyos Excel Discussion (Misc queries) 1 November 6th 09 09:06 PM
I need to simplify this... j5b9721 Excel Worksheet Functions 5 July 23rd 09 09:03 AM
Simplify code Inkel Excel Worksheet Functions 3 March 27th 09 05:52 PM
Need to simplify code alexwren Excel Discussion (Misc queries) 7 August 15th 06 08:07 PM
simplify code matt Excel Discussion (Misc queries) 3 September 28th 05 11:53 PM


All times are GMT +1. The time now is 09:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"