how to call subprocedure from within procedure?

D

dreamz

Leith said:
Hello Dreamz,

The code should be working as is. I have tried several variations o
the Copy and PasteSpecial to duplicate the problem, but I can't.
created a UserForm with a checkbox, and placed the paste code into
project module, and everything works. Which means there is somethin
else causing the problem. I look over your code again and see if I ca
spot something.

Sincerely,
Leith Ross
hello,

thank you very much for your help. i appreciate it.

i have no idea why it's not working. i can't see any problem with th
code itself (the calculate procedure works if i paste it into th
procedure instead of using "call").

i also just tried putting the code in a different module and callin
it:


Code
-------------------
Call Module3.Calculat
-------------------

neither procedure worked this time.

i guess i will never know what's wrong with this.

but thanks again. :
 
L

Leith Ross

Hello Dreamz,

Is the list being copied successfully into Range("A1:A362") ? It hard
to understand why the code isn't working if the data is being moved
from the list to the cells that are to be copied to then paste on the
Worksheet determined by the checkbox. Without being able to see the
Workbook code in its entirety, I don't think we can resolve this
problem. Its often the little things that cause the biggest problems.
Sorry we couldn't fix it.

Sincerely,
Leith Ross
 
D

dreamz

Leith said:
Hello Dreamz,

Is the list being copied successfully into Range("A1:A362") ? It hard
to understand why the code isn't working if the data is being moved
from the list to the cells that are to be copied to then paste on the
Worksheet determined by the checkbox.
the listsub procedure works until the procedure call. what i mean is,
the last step before the procedure call works. the list is created from
the listboxes and pasted into Temp!A1:A362. this works perfectly and in
fact, the list is copied.

the next step (call calculate) does not seem to work. the list is not
pasted into the other sheets. i don't see why this would fail, though.
all it's doing is checking to see if the checkbox was ticked. if it is,
then it pastes it. if it isn't, then it doesn't paste it. crazy excel.
Without being able to see the Workbook code in its entirety, I don't
think we can resolve this problem. Its often the little things that
cause the biggest problems. Sorry we couldn't fix it.

Sincerely,
Leith Ross
no worries. you've been extremely helpful and i've learned a lot just
from this thread. cheers!
 
L

Leith Ross

Hello Dreamz,

To test if the data is really on clipboard, select a cell on a
worksheet and select Paste Special from the Excel Edit menu and see if
it does Paste the date. If it does then problem lies with Calculate, if
not the problem is most likely in Listsub.

Thanks,
Leith Ross
 
D

dreamz

Leith said:
Hello Dreamz,

To test if the data is really on clipboard, select a cell on a
worksheet and select Paste Special from the Excel Edit menu and see if
it does Paste the date. If it does then problem lies with Calculate, if
not the problem is most likely in Listsub.

Thanks,
Leith Ross
yes, it is. i can paste after the procedure finishes, which means
listsub works (because it's just supposed to copy).

i have no idea what's wrong with the calculate procedure, though.


@david: thanks. i'll have a look.
 
D

dreamz

i realized that the procedure wasn't being called, so i created a dummy
procedure (msgbox "blah") and tried calling it. didn't work. so i
tried calling it at different points in the procedure, and they
worked.

so i discovered that there was some bug at the end of the code, and it
turns out, there was some code that i had put in to display error
messages.

i fixed up the code and now it works.

thanks again, everyone, especially you, leith. :)
 

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