Hi,
I have this code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim lineArray(1 To 3) As Range
Set lineArray(1) = Range("o.4b")
Set lineArray(2) = Range("o.c3b")
Set lineArray(3) = Range("o.f")
For LineCount = LBound(lineArray) To UBound(lineArray)
If Target.Address = lineArray(LineCount).Address Then
GoTo lineSelect
End If
Next LineCount
...
lineSelect:
Call lineSelect
Cancel = True
Exit Sub
...
End Sub
...
Private Sub lineSelect()
If ActiveCell.Offset(0, -1).Value = "" Then
Range(Cells(3, ActiveCell.Column - 1), Cells(5, ActiveCell.Column - 1)).ClearContents
ActiveCell.Offset(0, -1).Value = "+"
Else
ActiveCell.Offset(0, -1).Value = ""
End If
End Sub
...
Those ranges in lineArray are named ranges of a merged cell.
It works fine but it's annoying because even if I doubleclick anywhere else, it puts "+" to the left of the cell double clicked.
After googling, I think "If Not Intersect(Target, Range("___")) Is Nothing Then" is what I need to fix but I don't know how exactly with these ranges in array.
Could you help?
Bookmarks