Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I am using the code below which runs whenever a cell is edited -I think.
I would like to change this code so that it can be 'run' against a range of cells rather than as Worksheet_Change code. What do I need to do to do that ? Thanks Sub Worksheet_Change(ByVal Target As Range) Dim icolor As Integer If Range("A1").Value = "" Then If Not Intersect(Target, Range("B4:J34, B35:B39")) Is Nothing Then Select Case Target Case Sheet3.Range("A4") icolor = 34 Case Sheet3.Range("A5") icolor = 35 Case Sheet3.Range("A6") icolor = 38 Case Sheet3.Range("A7") icolor = 36 Case Sheet3.Range("A8") icolor = 37 Case Sheet3.Range("A9") icolor = 33 Case Else 'icolor = 50 'Whatever End Select Application.EnableEvents = False If icolor 30 And icolor < 51 Then Target.Interior.ColorIndex = icolor End If Application.EnableEvents = True End If End If End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Code to multiply two cells? | Excel Discussion (Misc queries) | |||
VBA code and protected cells | Excel Discussion (Misc queries) | |||
VB Code for clearing Cells | Excel Discussion (Misc queries) | |||
Format Cells by code | Excel Worksheet Functions | |||
VBA Code - NAME SEVERAL VARIABLE cells | Excel Worksheet Functions |