Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 469
Default stop application {on keys}

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default stop application {on keys}

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


--
Hope that helps.

Vergel Adriano


"Curt" wrote:

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i stop my arrow keys from scrolling? Joelle Excel Discussion (Misc queries) 3 July 24th 08 04:49 PM
Macro Shortcut Key Conflicts with Application Shortcut Keys Jordan Hotzel Excel Programming 0 October 13th 06 06:39 AM
Macro Shortcut Key Conflicts with Application Shortcut Keys Jordan Hotzel Excel Programming 0 October 13th 06 06:39 AM
Application.OnKey syntax for + and - keys Hotbird[_4_] Excel Programming 0 January 6th 06 09:30 PM
what is the keys to stop recording, i cant press it when making a. Lante Excel Discussion (Misc queries) 1 January 3rd 05 09:15 PM


All times are GMT +1. The time now is 08:20 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"