Trigger macro if an Activecell is within a specific Range

  • Thread starter Thread starter helmekki
  • Start date Start date
H

helmekki

Hi there

I have an Auto open Macro that runs another macro called Bouns...
the auto open macro runs perfectely the Bouns code...

my problem is: I want the Bouns macro proceeds working if an intege
is entered into the range("F19:F74"), otherwise exit subs i.e. if a
integer is entered else where in the sheet then exit Boun
sub................

I only know, if an integer is entered into a specifi
column.........................


PHP code
-------------------
Sub Auto_Open()
Sheet5.OnEntry = "Bouns"
End Sub

Sub Bouns()
Dim myrange As Range
Set myrange = Range("F20:F74")

With ActiveCell
If .Column = 6 Then

my code

end with
End Su
 
Why not code it in worksheet_change event?
It will be quite simple to do it there.
Try following code in Worksheet_Change macro for sheet5, which will
run Bonus if an integer is entered in range F19:F74

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 6 Then
If Target.Row > 18 And Target.Row < 75 And IsNumeric(Target.Value) Then
If Target.Find(".", LookAt:=xlPart) Is Nothing Then
Bonus
End If
End If
End If
End Sub

Sharad
 
Sub Bouns()
Dim myrange As Range
Dim trigger as Range
set trigger = Application.Caller
Set myrange = Range("F20:F74")

if trigger.count > 1 then exit sub
if intersect(trigger,myrange) is nothing then exit sub
if not isnumeric(trigger) then exit sub
if isempty(trigger) then exit sub
my code

end with
End Sub
 
Back
Top