I'm trying to run some code when a user doubleclicks on a worksheet cell but the BeforeDoubleClick sub never fires. Is there another way to capture doubleclicks?
I'm trying to run some code when a user doubleclicks on a worksheet cell but the BeforeDoubleClick sub never fires. Is there another way to capture doubleclicks?
How do you know it never fires? Have you tried putting a pause break in the code and trying it?
Could you attach the file? Desensitize it if necessary.
BSB
Never mind. I was putting the code in the wrong sheet. Dummy me!
But I do have another issue. When I doubleclick on a cell, it opens a form loaded with the data from the row. The issue is that the cell is now in edit mode and the form can't be edited unless I click on the worksheet to take the cell out of edit mode. Is there a way to prevent the cells from being edited? I only want data edited within the form.
Try adding the below just before the line that opens the form:
BSB![]()
Cancel = True
Unfortunately, that doesn't work. Any other suggestions?
This works fine for me.
![]()
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Cancel = True UserForm1.Show End Sub
Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.
That is working now. Had the code in the wrong place. Is there a way to lock the sheet so that the data is only editable using the form? I don't want the user prompted for a password (which I think protecting the sheet does).
You only need to unprotect and protect when writing back to worksheet.
![]()
Sheets("whatever").unprotect 'write edited data Sheets("whatever").protect
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks