PDA

View Full Version : Solved: Onkey to insert symbols



Digita
08-07-2007, 07:03 PM
Hi everyone,

Just wondering if the onkey event can be used to insert the following symbols in an active sheet:

Shift - c to insert the tick symbol
Shift - x to insert the cross symbol

My main problem is to find out the code for the Shift + c/x combination and the ANSI or unicode to insert these symbols. Thanks in advance for any help you would provide.

Regards

KP

Jan Karel Pieterse
08-07-2007, 11:05 PM
Application.OnKey "+c","ShiftC"

Will run ShiftC when you hit Shift + C:


Sub test()
Application.OnKey "+c", "ShiftC"
End Sub
Sub ShiftC()
ActiveCell.Value = Chr(120)
ActiveCell.Font.Name = "WingDings"
End Sub

Digita
08-08-2007, 12:44 AM
Hi Jan Karel Pieterse,

Thanks very much for your reply. Your codes work brilliantly. I modified your codes a bit to suit my purpose. For everyone's reference, here are the modified codes for shift C & shift X:



Sub ShiftC()
ActiveCell.Value = Chr(252)
ActiveCell.Font.Name = "WingDings"
End Sub
Sub ShiftX()
ActiveCell.Value = Chr(114)
ActiveCell.Font.Name = "Webdings"
End Sub


Kind regards


KP