Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-26-2011, 07:35 PM
sheen.buhay sheen.buhay is offline VBA Macro computational Windows XP VBA Macro computational Office 2007
Novice
VBA Macro computational
 
Join Date: Aug 2011
Posts: 7
sheen.buhay is on a distinguished road
Post VBA Macro computational

Hi,

May I ask the VBA Macro on how to apply IF condition and with corresponding computation.

Let us say:


1. I have a drop down menu in cell B2 that features Quantity of an item, cell C2 has the drop down menu of Print (service), cell D2 contains a drop down for Short bondpaper corresponding to the Size of the paper.
2. After I select those options like B2: 5 (quantity), C2: Print (type of service), D2: Short (size) it will return the value for 15 bucks.
In every 5 quantities of short bondpaper is worth 15. The value 15 will be displayed in cell D5

Thanks.

Last edited by sheen.buhay; 08-26-2011 at 11:10 PM.
Reply With Quote
  #2  
Old 08-26-2011, 10:11 PM
Catalin.B Catalin.B is offline VBA Macro computational Windows Vista VBA Macro computational Office 2007
Expert
 
Join Date: May 2011
Location: Iaşi, Romānia
Posts: 386
Catalin.B is on a distinguished road
Default

can you upload a sample workbook with sample data?
and details on how a selection made in cells B5 will affect the result
Reply With Quote
  #3  
Old 08-26-2011, 11:13 PM
sheen.buhay sheen.buhay is offline VBA Macro computational Windows XP VBA Macro computational Office 2007
Novice
VBA Macro computational
 
Join Date: Aug 2011
Posts: 7
sheen.buhay is on a distinguished road
Default

It seems I can't find the upload facility on the quick reply post. Please walk me through on how to upload the file on this thread.

Thanks.
Reply With Quote
  #4  
Old 08-26-2011, 11:15 PM
sheen.buhay sheen.buhay is offline VBA Macro computational Windows XP VBA Macro computational Office 2007
Novice
VBA Macro computational
 
Join Date: Aug 2011
Posts: 7
sheen.buhay is on a distinguished road
Post Re: VBA Macro computational

Attached is the excel spreadsheet without the macro.

The sample excel provides you the ability to select appropriate options and thus provides the desired results according to the selected data.
Attached Files
File Type: xls Book1.xls (18.0 KB, 7 views)
Reply With Quote
  #5  
Old 08-27-2011, 03:26 AM
Catalin.B Catalin.B is offline VBA Macro computational Windows Vista VBA Macro computational Office 2007
Expert
 
Join Date: May 2011
Location: Iaşi, Romānia
Posts: 386
Catalin.B is on a distinguished road
Default

try this formula: (replace red values as necessary) same formula in sample attached)
how many combinations can be in Columns C and D?
If there are too many, we need another approach...
=IF(AND(C2="Xerox";D2="Short")=TRUE;B2*2;IF(AND(C2="Print";D2="Short")=TRUE;B2*3;IF(AND(C2="Xerox";D2="Long")=TRUE;B2*5;IF(AND(C2="Print";D2="Long")=TRUE;B2*4;""))))
Attached Files
File Type: xls Book1.xls (20.5 KB, 7 views)
Reply With Quote
  #6  
Old 08-27-2011, 04:54 AM
sheen.buhay sheen.buhay is offline VBA Macro computational Windows XP VBA Macro computational Office 2007
Novice
VBA Macro computational
 
Join Date: Aug 2011
Posts: 7
sheen.buhay is on a distinguished road
Default

Thanks Catalin for your reply however I have no problem with the conditional statement with formula. What I want to achieve is to convert those behavior to VBA Macro.

Thanks.
Reply With Quote
  #7  
Old 08-27-2011, 11:51 PM
Catalin.B Catalin.B is offline VBA Macro computational Windows Vista VBA Macro computational Office 2007
Expert
 
Join Date: May 2011
Location: Iaşi, Romānia
Posts: 386
Catalin.B is on a distinguished road
Default

you can try the sample attached...
Attached Files
File Type: xlsm Book1.xlsm (17.4 KB, 7 views)
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I assign a macro to a button when the macro is in my personal workbook? foolios Excel Programming 2 07-27-2011 02:41 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:26 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft