Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default If statement to call module based on cell value

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default If statement to call module based on cell value

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.

Scott wrote:

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


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default If statement to call module based on cell value

On Jun 18, 5:40 pm, Dave Peterson wrote:
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.





Scott wrote:

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


--

Dave Peterson- Hide quoted text -

- Show quoted text -


Worked great, thanks Dave!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
using an if then statement call a caption box to a cell ratt[_3_] Excel Programming 2 June 20th 05 05:24 AM
using an if then statement call a caption box to a cell ratt[_2_] Excel Programming 1 June 16th 05 05:30 AM
using an if then statement call a caption box to a cell mangesh_yadav[_325_] Excel Programming 0 June 16th 05 05:02 AM
Call a macro or sub based on the name of a cell? Tom Ogilvy Excel Programming 1 August 26th 03 06:15 PM
Call a macro or sub based on the name of a cell? steve Excel Programming 0 August 25th 03 10:39 PM


All times are GMT +1. The time now is 10:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"