NUMLOCK Status 數字鍵鍵盤狀態

                  Public Const VK_NUMLOCK = &H90

Public Declare Function GetKeyState Lib "user32" _
(ByVal nVirtKey As Long) As Long


Function NUMLOCKstatus() As Boolean 'https://www.mrexcel.com/forum/excel-questions/677200-visual-basic-applications-remember-numlock-state.html
'MsgBox "Numlock is " & IIf(GetKeyState(VK_NUMLOCK) = 1, "On", "Off")
If GetKeyState(VK_NUMLOCK) = 1 Then
    NUMLOCKstatus = True
End If
End Function