Syntax help

jim may

Well-known Member
Joined
Jul 4, 2004
Messages
7,486
In A Double-Click Event Macro I'm Having Syntax issues in getting the 2nd code line to "take"
Code:
Lr = Range("C" & Rows.Count).End(xlUp).Row
If Not Intersect(Target, Range("N & Target.Row & ":P" & LR)) Is Nothing Then
What's the proper syntax?

TIA,

Jim
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
You're missing the closing " after the N
 
Upvote 0
In a DoubleClick event, Target is only one cell.
It looks like you are checking for

Code:
If (Target.Row<=LR) and (14 >= Target.Column) And (Target.Column <=16) Then
 
Upvote 0
If you double click on the columns from N to P, this line will always be true.

Code:
If Not Intersect(Target, Range("N" & Target.Row & ":P" & lr)) Is Nothing Then

Because if the last cell in column C
Code:
lr = Range (" C "& Rows.Count) .End (xlUp). Row
is 10 and you press double click on cell N15, the intersection range is "N15:P10" then N15 is within the range.


Maybe you want to validate only one range, for example from N2 to P & LR, try this:

Code:
    lr = Range("C" & Rows.Count).End(xlUp).Row
    If Not Intersect(Target, Range("N2:P" & lr)) Is Nothing Then

But I think we're speculating, better explain what you need.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,249
Members
452,623
Latest member
Techenthusiast

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top