If statement to call module based on cell value

S

Scott

Hello-

I have a module that will combine two workbooks, calculate certain
cells, then email the summary information to a group of individuals on
our management team.

Cell D5 is formatted as a percentage and I want to send to a specific
group based on the value of the cell.

I have two modules, SendStats (mid managers), and SendStats1 (mid
managers and upper management) used to determine which
group will be emailed.

If cell D5 is greater than 3%, I want to call module SendStats1,
otherwise I want to call module SendStats.

I tried an IF statement in VBA, but could not get it to work right.
Can someone help?

Thanks-

Scott
 
D

Dave Peterson

if workbooks("someworkbookname") _
.worksheets("someworksheetname").range("d5").value > .03 then
call sendstats1
else
call sendstats
end if

I bet you meant you had two procedures named SendStats and Sendstats1--not
modules.

If the module names were really SendStats and SendStats1, then you'll have to
change the "call" statements in the code to match the subroutine names.

And don't give the procedures and modules the same name. It can confuse excel
really bad.
 
S

Scott

if workbooks("someworkbookname") _
.worksheets("someworksheetname").range("d5").value > .03 then
call sendstats1
else
call sendstats
end if

I bet you meant you had two procedures named SendStats and Sendstats1--not
modules.

If the module names were really SendStats and SendStats1, then you'll have to
change the "call" statements in the code to match the subroutine names.

And don't give the procedures and modules the same name. It can confuse excel
really bad.











--

Dave Peterson- Hide quoted text -

- Show quoted text -

Worked great, thanks Dave!
 

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