Skip to content

Instantly share code, notes, and snippets.

@Mahno74
Last active June 29, 2022 05:18
Show Gist options
  • Save Mahno74/0929acabfc0475f6f88711670bd35b54 to your computer and use it in GitHub Desktop.
Save Mahno74/0929acabfc0475f6f88711670bd35b54 to your computer and use it in GitHub Desktop.
Переключаем раскладки в зависимости от выбранного столбца
Private Declare Function ActivateKeyboardLayout _
Lib "user32" (ByVal HKL As Long, ByVal flags As Long) As Long
Const kb_lay_ru As Long = 68748313, kb_lay_en As Long = 67699721
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Так работает для листа Если надо для всей книги то оборачиваем в Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
Select Case Target.Column ' select Column
Case 7 ' for column 7
SetRusLayout
Case 2 To 6: ' for Columns fron 2 to 6
SetEngLayout
Case Else: ' Making noting
End Select
End Sub
Sub SetRusLayout()
' Set russian
ActivateKeyboardLayout 0, 0
End Sub
Sub SetEngLayout()
' Set English
x = ActivateKeyboardLayout&(kb_lay_en, 0)
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment