BeforeDoubleClick on Locked Cell

rickincanada

Board Regular
Joined
Aug 31, 2010
Messages
61
I have a need to display a user form using the BeforeDoubleClick Event in VBA. The problem I'm having is that the cell I want the user to double-click in is locked and the sheet is protected. I can make it work if the cell is unlocked or if the sheet is not protected however this puts the formula in there at risk of being changed.

Here is my VBA:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

If Target.Address = "$F$25:$G$25" Then
Call PriceRollback
End If

End Sub

Can anyone help me to do this without exposing this cell? Or is it even possible?

Thanks,
Rick
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Why not unlock and then lock before and after the Call line?
 
Upvote 0
What am I missing:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

If Target.Address = "$F$25:$G$25" Then
Sheets("Deal Info").Select
Sheets("Deal Info").Unprotect ("password")
Range("$F$25:$G$25").Select
Selection.Locked = False
Call PriceRollback
Range("$F$25:$G$25").Select
Selection.Locked = True
Sheets("Deal Info").Protect ("password")
End If

End Sub

Still isn't working...sorry if I'm making this painful for you.
 
Upvote 0
Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Cancel = Target.Locked
If Not Intersect(Target, Range("$F$25:$G$25")) Is Nothing Then
Call PriceRollback
End If

End Sub

Note that you need to allow the user to select unlocked cells (the default option)
 
Upvote 0

Forum statistics

Threads
1,223,234
Messages
6,170,891
Members
452,366
Latest member
TePunaBloke

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