How to run 2 CreateEventProc modules on 2 sheets simultaneously

N

noname

Hi,

I have 2 code modules (Workcode1 n Workcode2) which have VBA code for
CreateEventProc to enter them into 2 sheets say Sheet1 n Sheet2.

i m calling them from a single module called Doit() like this:

Sub Doit()
Sheets("Sheet1").Activate
Call Workcode1
Sheets("Sheet2").Activate
Call Workcode2
End Sub

giving me Runtime error 9, subscript out of Range. I see that only
workcode1 gets added to sheet1 and not workcode2 to sheet2.

if i do the vice-versa, i see that it only adds 1 module either
workcode1 or workcode2....so i have come to the conclusion that it
does not allow 2 CreateEventProc 2 run 1 after the other....it CRASHES
EXCEL.

How do i go about rectifying this now....Any suggestions r most
welcome..

Regards
 
B

Bob Phillips

What is in WorkCode1 and 2?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
N

noname

Hi Tim,

There is no line highlighted.

Both CreateEventProc Codes run perfectly well if i run them one at a
time, but they always crash Excel when i run them simultaneously.

I think its probably bcos Excel cant handle multiple calls to the same
event procedure CreateEventProc.

Is there a solution to this? As this is the only part now to finish
off my project....n i m damn stuck n frustrated by this..


Regards,
 
N

noname

Workcode1 and Workcode are 2 diff modules which have the
CreateEventProc 's for each Sheets... say Sheet1 and Sheet2.

rgds,
 
B

Bob Phillips

Can we see the code?

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
N

noname

Sure Bob,

Tell me how i can send the file across to you....I will dump the
modules into a new workbook and send it across it to you.


Cheers!
 
N

noname

Also wanted to know how i can AVOID the code VBE window open up, when
I run the CreateEventProc to dump the code into a Sheet. Ideally, it
should show me the Sheet not the VBE code window.

Cheers
 

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

Top