Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error using two codes whtin the one worksheet in Excel

Status
Not open for further replies.

Aspesim

Technical User
Jan 7, 2009
15
EU
Hi

Can you have 2 codes in one Worksheet?

I have one code for searching for data starting with
Private Sub Worksheet_Change(ByVal Target As Range)

Then I've added another code which adds the date automaticlly in cell AK starting with
Private Sub Worksheet_Change(ByVal Target As Range)

Both will work independantly but when both are used the second one is highlighted and an error is displayed saying Ambiguous Name Detected: Worksheet_Change

Can 2 be used?

Regards
Aspesim


 


Hi,

"Can you have 2 codes in one Worksheet?"

You can have MANY procedures in one Worksheet Object code window or Module.

HOWEVER, each procedure must have a unique name.

Why not take the code in each of the Worksheet_Change event procedures, and make TWO procedures with Unique Names.

Then delete ONE of the duplicate Worksheet_Change procedures.

Then call your two new procedures from the Worksheet_Change event.

Skip,
[glasses]Don't let the Diatribe...
talk you to death![tongue]

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top