Can you copy the code to a message here?
best wishes
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello Community
I am creating a VBA Project yet when I try to run it I get "Compile Error" message. How do I fix it ? I understand that the message is stating that Exel does not understand the command I am trying to Implement, but I have no Idea how to fix it.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Can you copy the code to a message here?
best wishes
I am Copying both Code and the work sheet I am setting up. This sheet is to be activated within the entire workbook which consist of a number of pages.
Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
End Sub
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Range("D3:N11")) Is Nothing Then
If Taget.Value = "Ð" Then
Target.Value = "Ï"
Exit Sub
End If
If Target.Value = "x" Then Target.Value = "Ð"
If Target.Value = "Ï" Then Target.Value = "x"
If Target.Value = Empty Then Target.Value = "Ð"
End If
End Sub
***Please note that "Ð" represents Unlock, "Ï" represents Lock, and "x" represent's "restricted"
These commands are supposed to work on the double click, but nothing is working even with the first line of code. Upon testing, the "lock" symbol does not convert to "unlock" or "restricted". Nor does clicking any of the blank cells work on the double click.
Any help you can give is greatly appreciated.
| User | Admin | Sheet 1 | Sheet 2 | Sheet 3 | Sheet 4 |
|---|---|---|---|---|---|
| Jamie | "Ð" | "Ï" | "x" | ||
Thanks,
JeanMarie
I noticed a typo in your code:
If Taget.Value = "Ð" Then
You are missing a r in Target
If Target.Value = "Ð" Then
First question: have you put the code into the correct Worksheet module?
A working file may be found in my Public folder of my OneDrive;
I have changed all accented letters to unaccented, so "Ð" is coded as ""D", etc.
Link is:
https://1drv.ms/x/s!AkhpKJf_GSEWgfJ9OaOKGe4PlyFagg
best wishes
Try this. . . .
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Range("D3:N11")) Is Nothing Then
If Target.Value = Chr(208) Then
Target.Value = Chr(207)
Exit Sub
Cancel = True 'added this
End If
If Target.Value = "x" Then Target.Value = Chr(208)
If Target.Value = Chr(207) Then Target.Value = "x"
If Target.Value = Empty Then Target.Value = Chr(208)
End If
Cancel = True
End Sub
Gord