Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Brian,
I need to have a method to have a macro automatically run whenever a specific range of cells change. I am not a great VBA programmer so hopefully this is easy to do. Sure. Go to the VBE, find the code module for the sheet, select 'Worksheet' in the top-left dropdown of the code window and the Change event in the top-right. Then put some code in that event. In the code below, I've assumed you've named the range to check 'rngChanges': Private Sub Worksheet_Change(ByVal Target As Range) Dim rngCells As Range 'Get the cells that have changed within our range Set rngCells = Application.Intersect(Target, Me.Range("rngChanges")) If Not rngCells Is Nothing Then 'rngCells points to the cell(s) that have changed within the range rngCells.Interior.ColorIndex = 3 End If End Sub Regards Stephen Bullen Microsoft MVP - Excel www.oaltd.co.uk |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to automatic calculation and macro execution between 3 workbooks? | Excel Worksheet Functions | |||
Changing cell values between columns with macro | Excel Programming | |||
Automatic execution of macro | Excel Programming | |||
automatic macro execution | Excel Programming |