Hi my main aim is to disable entering special characters by user after he open an excel sheet using a macro in VBA
I tried how to do it. I found one method for one character.
Sub Disable_Keys()
Dim KeysArray As Variant
Dim Key As Variant
KeysArray = Array("@", "!", "~")
'Disable the StartKeyCombination key(s) with every key in the KeysArray
For Each Key In KeysArray
Application.OnKey Key, "myMsg"
Next Key
End Sub
Sub myMsg()
MsgBox "All keys are valid characters"
End Sub
There is a problem with this one i am only disable two keys in that array. If i add 3 one like "~". It's not working for that key.
If you have any other solutions also please help me.