cgcamal
Active Member
- Joined
- May 2, 2007
- Messages
- 472
Hi everyone,
I have the code below that runs Macro1 when I select cell within the range $B$7:$I$1000.
But I want to run Macro1 If I enter a value in selected cell, not only when is selected, because Macro1
is intended to copy the value I enter to other cell.
How can I do this?
Many thanks in advance.
Best regards
I have the code below that runs Macro1 when I select cell within the range $B$7:$I$1000.
But I want to run Macro1 If I enter a value in selected cell, not only when is selected, because Macro1
is intended to copy the value I enter to other cell.
How can I do this?
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
[COLOR=Green]'target range to monitor[/COLOR]
If Not Intersect(Target, Range("$B$7:$I$1000")) Is Nothing Then
On Error Resume Next
Application.EnableEvents = False
Addr = Target.Address
If IsEmpty(Range(Addr)) Then [COLOR=Green]'Verify if current cell selected is empty
'Do some code[/COLOR]
[B] [COLOR=Navy]Call [/COLOR]Macro1 [/B][COLOR=Green]'I want to run this macro if data is entered in Target cell[/COLOR]
End If
On Error GoTo 0
Application.EnableEvents = True
End If
End Sub
Best regards