Worksheet Selection Change

  • Hello:


    Im currently writing a pretty simple macro where when I select a particular cell it runs a macro automatically. When I click on the target cell simply nothing happens. I have turned on events using ctrl+G and typing Application.EnableEvents = True. Here is my code and any help is welcome.


    Code
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
     
    Dim KeyCell As Range
    Set KeyCell = Range("B43")
    If Target.Address = KeyCell Then
    Call Macro1
    End If
     
    End Sub


    In addition, here is the Macro1 I am trying to call:


    Code
    Sub Macro1()
    Range("d35").Select
    If ActiveCell<>ActiveCell.Offset(0,1) Then
    Range("d35:e35").Select
    End if
  • Re: Worksheet Selection Change


    Is it because nothing has changed? your code is Worksheet_SelectionChange, but you have said when you click into a cell... So you need to change the text in the cell, or change the code to click

  • Re: Worksheet Selection Change


    From what I understood SelectionChange fired a macro upon selecting a cell (hopefully in particular the key cell I have set). In addition, I have tried entering data into that cell and that has not worked either.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!