none
EXCEL VBA RRS feed

  • Question

  • I would like to do the following. If cell A1 contains "Hello" and if the focus is on A1 and if the Enter key is pressed, then the focus should go to B2 and MsgBox should appear.


    • Edited by AJAY RAWAT Friday, December 26, 2014 12:54 PM
    Friday, December 26, 2014 12:53 PM

Answers

  • Hello,

    try to add the following change event:

    Private Sub Worksheet_Change(ByVal Target As Range)
       If Target.Address = "$A$1" And Target.Value = "Hello" Then
            ActiveSheet.Range("b2").Select

            call msgbox("input hello")

        End If
    End Sub

    Hope it helps,

    Wouter



    Friday, December 26, 2014 1:01 PM