Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 411
Default userform control structure strategy help request

Hi,

Using Excel 2000, userforms, vba and sql, I'm creating a quoting
application for an electrical parts manufacturer. I've developed some
userforms, and I have a
code sample (below) that uses vlookup to pull the price from the price
table.
(Thanks to Dave Peterson.)

The quantity column is hard coded in the vlookup in Dave's sample.

I need to incorporate the quantities, delivery times and adders to the
code.
So I imagine the user will need to enter the part number in a textbox,
choose the
proper formula from a dropdown, enter any criteria that isn't shown in
the price
formula, and press a command button to calculate the prices. Then hold
the data
and recalculate for each requested quantity and delivery time, i.e., 8
weeks.

I've got 32 textboxes to hold the adder information.

I'm getting confused how to design the vba to calculate
all the prices for a quote. I think I need a vlookup for each adder.

I have been researching vba control structures
for the last two weeks to understand how to code this quote pricing.

I've searched the this forum for "Control structures", and found
several resources
like: http://www.aspfree.com/c/a/VB.NET/Pr...s-Using-VBA/4/

Naming conventions: http://support.microsoft.com/kb/110264

Control structure ideas:
http://www.microsoft.com/office/comm...337&sloc=en-us

I'm still not clear how to organize the code for this project.
Consequently, I seek
feedback to understand possible control structure.

Thanks for your suggestions,

Dan

----------------------------------------------------------------------

Here are the rules, as I know them now:

1. Each quote has one quote number--assigned by the system.
2. A quote can contain pricing for an unlimited amount of part
numbers.
2. Pricing for a part number is determined by a pricing formula.

a. the core part price
b. adder prices-there could be several
c. the markup percentage
d. the setup cost

The pricing formulas are held in a spreadsheet--tblFormula.
Each formula resides on a row in the spreadsheet.
The required adders reside in cells on that row. The adders
indicate which
price list to use for the components of the part.

3. The price list worksheets follow the same format where the first
cell
in the row tells the criteria and the other cells hold the prices
for
each price break.

a. tblPriceListCorePart
tblPriceListAdderEntry
tblPriceListSelfLock
tblPriceListMod
tblPriceListClamp

b. some price lists don't have price breaks--their prices a just
one column
and applied regardless of the quantity.

tblConnectorCode
tblChain
4. Each part number can have several quantites

a. the price breaks
1-9
10-19
20-49
50-99
100-249
250-499
500-999
1000-2499
2500-4999
5000 & UP

Code Sample
__________________________________________________ _________

Private Sub cmdCalc_Click()
'From: Dave Peterson
'Date: Thu, 25 Feb 2010 21:06:05 -0600

Dim sCoreAdapShell As String 'it's all text, right?
Dim res As Variant 'could be an error

sCoreAdapShell = txtCore.text & txtAdap_Config.text & txtShell.text

res = Application.vLookup(sCoreAdapShell, _

ThisWorkbook.Worksheets("tblPriceListCorePart").Ra nge("tblPriceListCore"),
_
5, False)

If IsError(res) Then
'like #n/a in excel
Me.txtShellEntrySum.text = "not found!"
Else
Me.txtShellEntrySum.Value = res * Me.txtCore_Multiplier.Value
End If
End Sub
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
Do I need to use VBA for the following control structure? cfman Excel Discussion (Misc queries) 2 March 1st 07 11:42 AM
Do I need to use VBA for the following control structure? cfman Excel Programming 2 March 1st 07 11:42 AM
Selecting control on userform with part of control name (set question) Keith Excel Programming 4 January 10th 07 02:24 PM
Strategy Needed kleivakat Excel Discussion (Misc queries) 2 March 7th 06 09:09 PM
Control Sequence from Userform Control Nigel Excel Programming 3 December 29th 04 01:25 PM


All times are GMT +1. The time now is 09:35 PM.

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"