Compile error message

mmdmalta

New Member
Joined
Oct 9, 2006
Messages
40
hello, I used a VCA formula in my spread sheet. I want to do the exact same thing, but in a different area of the spread sheet. This is the formula i used and it worked in one area, but not the other.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Range("b12:f12")) Is Nothing Then
Cancel = True
Target.Interior.Color = vbYellow
End If
End Sub

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Range("b12:f12")) Is Nothing Then
Cancel = True
Target.Interior.Color = Cancel = False
Target.Interior.Color = vbWhite
End If
End Sub

The second area with the range B12:f12, pops up a window that i have a compile errpr" Ambiguous name detected: Worksheet) BeforeDoubleClick. Can you tell me what i need to do with this second area inside the VBA code?
 
The reason nothing is changing, is that you have changed the right click event from VbWhite to VbYellow
 
Upvote 0

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
i think that finally did it. I wanted both sections to work the same way when double clicked and right clicked. The other section does the opposite, but at this point, i'll settle for that. Thank your for your help! I appreciate it!
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,216,474
Messages
6,130,841
Members
449,598
Latest member
sunny_ksy

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