Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I don't understand what you're doing, but maybe this will give you an outline:
Option Explicit Private Sub Worksheet_Change(ByVal Target As Range) If Target.Cells.Count 1 Then Exit Sub On Error GoTo ErrHandler If Not Intersect(Me.Range("L2:m20"), Target) Is Nothing Then 'you're in L2:M2, so do the stuff for L2:M2 here 'some code 'some more code Application.EnableEvents = False 'change some cells on the worksheet ElseIf Not Intersect(Me.Range("A2:B2"), Target) Is Nothing Then 'you're in A2:B2 'do what you need Application.EnableEvents = False 'change some different cells on the worksheet End If ErrHandler: Application.EnableEvents = True End Sub Ben Dummar wrote: I am trying to combine the two intersect ranges below into one macro that is in a worksheet tab. The outside if range works but the inside one doesn't. What do I need to do to fix it? Private Sub Worksheet_Change(ByVal Target As Excel.Range) Dim R As Long R = Target.Row On Error GoTo ErrHandler Application.EnableEvents = True If Not Intersect(Range("L2:m20"), Target) Is Nothing Then If Not Intersect(Range("A2:B2"), Target) Is Nothing Then End If If Target.Column < 9 Then Exit Sub If Target.Row = 1 Then Exit Sub Target.Offset(0, -2).Value = Date '<<== CHECK RANGE End If If Target.Column < 2 Then Exit Sub If Target.Row = 1 Then Exit Sub Target.Offset(0, 2).Value = Date ErrHandler: Application.EnableEvents = True End Sub Thanks, Ben -- Dave Peterson |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
IF statements referencing an absolute value or a range of values | Excel Worksheet Functions | |||
How can I intersect 2 trendlines on the same spreadsheet? | Excel Discussion (Misc queries) | |||
Intersect operations | Excel Worksheet Functions | |||
Combine multiple cells into one cell range. | Excel Worksheet Functions | |||
how to combine cells by selecting range? | New Users to Excel |