ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Trigger macro if an Activecell is within a specific Range (https://www.excelbanter.com/excel-programming/314485-trigger-macro-if-activecell-within-specific-range.html)

helmekki[_43_]

Trigger macro if an Activecell is within a specific Range
 

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
-------------------


:confused: :confused

--
helmekk

-----------------------------------------------------------------------
helmekki's Profile: http://www.excelforum.com/member.php...nfo&userid=693
View this thread: http://www.excelforum.com/showthread.php?threadid=27177


Sharad Naik

Trigger macro if an Activecell is within a specific Range
 
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

"helmekki" wrote in message
...

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 integer
is entered into the range("F19:F74"), otherwise exit subs i.e. if an
integer is entered else where in the sheet then exit Bouns
sub................

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


Formula:
--------------------
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 Sub
--------------------


:confused: :confused:


--
helmekki


------------------------------------------------------------------------
helmekki's Profile:
http://www.excelforum.com/member.php...fo&userid=6939
View this thread: http://www.excelforum.com/showthread...hreadid=271778




Tom Ogilvy

Trigger macro if an Activecell is within a specific Range
 
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

--
Regards,
Tom Ogilvy


"helmekki" wrote in message
...

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 integer
is entered into the range("F19:F74"), otherwise exit subs i.e. if an
integer is entered else where in the sheet then exit Bouns
sub................

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


Formula:
--------------------
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 Sub
--------------------


:confused: :confused:


--
helmekki


------------------------------------------------------------------------
helmekki's Profile:

http://www.excelforum.com/member.php...fo&userid=6939
View this thread: http://www.excelforum.com/showthread...hreadid=271778





All times are GMT +1. The time now is 03:02 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com