stop application {on keys}

G

Guest

This code is in my data worksheet whenever any data is copied to other sheets
the on key apps. go with it. Can I stop the on key apps. from being active on
sheets copied to? Ckeck up is a procedure that checks for row data completed.
I thought that as a private sub it would only be active on this sheet

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
On Error GoTo errhandler
Application.EnableEvents = False
If Target.Column = 12 And Target.Value > (" ") Then _
Call Announcer(Target)
If Target.Column = 8 And Target.Value > 1 And IsNumeric(Target.Value)
Then _
Call CopyMailE(Target)
If Target.Column = 11 And Target.Value > 10 And IsNumeric(Target.Value)
Then _
Call CopyDonors(Target)
If Target.Column = 11 And Target.Value > 10 And IsNumeric(Target.Value)
Then _
Call CopyMailD(Target)
errhandler:
Application.EnableEvents = True
Application.OnKey "{RETURN}", "checkUp"
Application.OnKey "{DOWN}", "checkUp"
End Sub
 
G

Guest

Hi Curt,

If I understand it correctly, you have the procedure on your data sheet and
you don't want it to execute on copies of the data sheet.. Even if you
declare the sub as private, when you make a copy, the copy will have it's own
private copy of the procedure as well. Perhaps, if in your checkUp
procedure, check the name of the datasheet.. For example, assuming the name
of your datasheet is "Data":

Private Sub checkUp

'if this sub is not on the original data sheet. don't do anything.
If Me.Name <> "Data" then Exit Sub

'... the rest of your code here...

End Sub

If you use that approach, you might want to consider moving it to a module
and just declare it as a public sub. Then check the name of the activesheet.


Public Sub checkUp

'if this sub is not on the original data sheet. don't do anything.
If ActiveSheet.Name <> "Data" then Exit Sub

'... the rest of your code here...

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

target value 1
conflict with code 7
chg by val 1
worksheet_change becoming active just by entering the cell 1
Code comonr to all worksheets 4
Mixed format 5
Stop duplicate record 3
clear contents re value 9

Top