• Numlock turns off/on when macro is run

    Author
    Topic
    #479005

    Hi,

    I have a very small macro shown below to insert an X mark then move to the next cell. When I first created this macro the last command was as follows : Sendkeys “{TAB}”. The story is this, I am using Excel 2007 in a Win 7 Virtual Desktop – whenever I ran the macro in this environment, the Numlock would turn off and if I ran it a second time Numlock turned back on :confused: – If I ran it under my normal XP desktop version of Excel 2007 – no issue. This was very annoying and I had to change the code to that shown below to stop the Numlock issue. Does anyone know why this should happen.

    Sub XMark()

    ‘ XMark Macro
    ‘ Insert X in Wingdings font


    ActiveCell.FormulaR1C1 = “û”
    With Selection.Font
    .Name = “Wingdings”
    .Size = 14
    .Strikethrough = False
    .Superscript = False
    .Subscript = False
    .OutlineFont = False
    .Shadow = False
    .Underline = xlUnderlineStyleNone
    .ThemeColor = xlThemeColorLight1
    .TintAndShade = 0
    .ThemeFont = xlThemeFontNone
    End With

    With Selection
    .HorizontalAlignment = xlCenter
    End With

    ActiveCell.Offset(0, 1).Select
    End Sub

    Regards,
    Maria

    Viewing 1 reply thread
    Author
    Replies
    • #1298320

      It’s a known issue with SendKeys. There is some replacement code here if you need it, but there is no need for it here. The code you have is better anyway. 🙂

    • #1298322

      Thanks Rory, Good to know that I am not going crazy – I couldn’t figure out how sendkeys {TAB}” would turn off/on Numlock. The good thing about the new code is that if I want to change the code to move down after putting the X mark, I can simply change the offset to (1,0) instead of (0,1).

      Regards,
      Maria

    Viewing 1 reply thread
    Reply To: Numlock turns off/on when macro is run

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: