Consulting

Results 1 to 3 of 3

Thread: Solved: Onkey to insert symbols

  1. #1
    VBAX Contributor
    Joined
    Apr 2006
    Posts
    144
    Location

    Solved: Onkey to insert symbols

    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

  2. #2
    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
    Regards,

    Jan Karel Pieterse
    Excel MVP jkp-ads.com

  3. #3
    VBAX Contributor
    Joined
    Apr 2006
    Posts
    144
    Location

    Smile

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •