Consulting

Results 1 to 5 of 5

Thread: Disable Arrow Keys

  1. #1

    Disable Arrow Keys

    Hi, i would like to know how i can disable arrows keys if i select determined range of cells (for example A1:A20), i am asking that because i run macro when somebody change value of this cells automatically and if person press left/right arrow key, macro not work fine, so i would like to arrow lock on this range of cells, its possible ? Thanks

  2. #2
    Somebody have solution or part of solution ? Please help me. Thanks for all

  3. #3
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    Sounds like you need to modify your code instead.

    To run a macro use OnKey(). Type OnKey in the VBE and press F1 for help to see how it is used.

  4. #4
    Quote Originally Posted by Kenneth Hobs
    Sounds like you need to modify your code instead.

    To run a macro use OnKey(). Type OnKey in the VBE and press F1 for help to see how it is used.
    Hi i want use only macro work if i press ENTER. My Macro code is:

    [VBA]Sub Macro8()
    Application.ScreenUpdating = False

    ActiveCell.Offset(-1, 0).Rows("1:1").EntireRow.Select
    Selection.Copy
    ActiveCell.Offset(1, 0).Rows("1:1").EntireRow.Select
    Selection.Insert Shift:=xlDown
    ActiveCell.Offset(0, 2).Range("A1:G1").Select
    Application.CutCopyMode = False
    Selection.ClearContents

    ActiveCell.Offset(0, 0).Range("A1").Select
    End Sub[/VBA]

    My Sheet code that make macro run automatically on change is:


    [VBA]Private Sub Worksheet_Activate()
    Application.DisplayFullScreen = True
    Application.DisplayStatusBar = False
    Application.DisplayFormulaBar = False
    ActiveWindow.DisplayHeadings = False
    ActiveWindow.DisplayHorizontalScrollBar = False
    ActiveWindow.DisplayVerticalScrollBar = False
    ActiveWindow.DisplayWorkbookTabs = False
    End Sub

    Private Sub Worksheet_Change(ByVal Target As Range)

    Application.EnableEvents = False
    If Not Intersect(Target, Range("I5:I50000")) Is Nothing Then
    Call Módulo1.Macro8
    End If

    Application.EnableEvents = False
    If Not Intersect(Target, Range("F7800:F50000")) Is Nothing Then
    Call Módulo3.Macro3
    End If

    Application.EnableEvents = True
    End Sub
    Private Sub cmd_edicao_Click()

    Application.DisplayFullScreen = False
    Application.DisplayStatusBar = True
    Application.DisplayFormulaBar = True
    ActiveWindow.DisplayHeadings = True
    ActiveWindow.DisplayHorizontalScrollBar = True
    ActiveWindow.DisplayVerticalScrollBar = True
    ActiveWindow.DisplayWorkbookTabs = True
    End Sub
    Private Sub Cmd_voltar_Click()
    Sheets("Resumo").Select
    End Sub
    Private Sub cmd_save_Click()
    ActiveWorkbook.Save
    End Sub
    Private Sub cmd_exit_Click()
    Application.Quit
    End Sub[/VBA]

    Cells that run macro automatically is I5:I5000, i dont know how to patch it to only work if press ENTER, Can you help me add this OnKey command to my code ? Thanks

  5. #5
    Please help solve it guys, should not be too complex...

Posting Permissions

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