View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Many Sub Worksheet_Change(ByVal Target As Range) In One Worksheet

Mathew,

You can have only one Worksheet_Change event procedure in a
worksheet's code module, and this one procedure will be called
automatically when any cell on the sheet is changed. The
reference to the changed cell is passed to the procedure via the
Target parameter.

Perhaps you could clarify your question, and someone might post a
more specific answer.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"MathewPBennett" wrote in message
...
Good evening all.
Re-posted again from misc. - sorry again.(RDB)

I am learning the usefulness of the Sub Worksheet_Change(ByVal

Target As Range)

However I cannot seem to resolve the fact that I do not seem to

be allowed
to have more than one of these subroutines in the same

worksheet, even though
they do different things and have different Target Values

and/or Ranges.

Am I missing something fundamental here? I have tried naming

the sub differently,
ie with Sub Worksheet2_Change(ByVal Target As Range) or
Sub Worksheet_Change2(ByVal Target As Range).. etc, but

to no avail.

Is this possible, or do I have to combine all my requirements

into one sub?

Thank you to Ron De Bruin for his post in misc. but I am really

non-the-wiser.

my code:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
If Not Application.Intersect(Range("AJ:AK"), Target) Is Nothing

Then
If Target.Value = "t" Then
Target.Value = Now
End If
End If
End Sub


I would like to repeat this in the same worksheet, for

different ranges,
and for different target values then different date, ie next

friday (for which
I have code from Tom O.)

Assistance required, sorry RDB.

Mathew




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.554 / Virus Database: 346 - Release Date:

20/12/2003