Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
SDH SDH is offline
external usenet poster
 
Posts: 19
Default lisbox reference and calculation

I have a lisbox(lboProduct) on a userform (UserForm3). The listbox references
a list of products on a worksheet (Sheet1) in column A. In column B of Sheet1
is the corresponding price of each product. The UserForm3 also has a TextBox
(txtQuantity). I have a command button (cmdCost) that when clicked needs to
show the total cost. Which is equal to the amount entered in txtQuantity *
the corresponding price of the product selected in the lboProducts.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default lisbox reference and calculation

On Apr 17, 7:40 pm, SDH wrote:
I have a lisbox(lboProduct) on a userform (UserForm3). The listbox references
a list of products on a worksheet (Sheet1) in column A. In column B of Sheet1
is the corresponding price of each product. The UserForm3 also has a TextBox
(txtQuantity). I have a command button (cmdCost) that when clicked needs to
show the total cost. Which is equal to the amount entered in txtQuantity *
the corresponding price of the product selected in the lboProducts.


And your question is .......


  #3   Report Post  
Posted to microsoft.public.excel.programming
SDH SDH is offline
external usenet poster
 
Posts: 19
Default lisbox reference and calculation

my coding experience is limited and i can not get it to work, can anyone help?

"matt" wrote:

On Apr 17, 7:40 pm, SDH wrote:
I have a lisbox(lboProduct) on a userform (UserForm3). The listbox references
a list of products on a worksheet (Sheet1) in column A. In column B of Sheet1
is the corresponding price of each product. The UserForm3 also has a TextBox
(txtQuantity). I have a command button (cmdCost) that when clicked needs to
show the total cost. Which is equal to the amount entered in txtQuantity *
the corresponding price of the product selected in the lboProducts.


And your question is .......



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default lisbox reference and calculation

Hello
Create two names on sheet1:
"Product" to refer to product names in column A
"Price" to refer to prices in column B
Then in the CmdCost_CLick place this:

Private Sub CmdCost_Click()
If Me.txtQuantity.Value < "" Then
prod = Me.lboProduct.Value
Pprice = Application.WorksheetFunction.Index(Range("Price") _
, Application.WorksheetFunction.Match(prod, Range("Product"), 0))
MsgBox Pprice * txtQuantity
End If
End Sub

HTH
Cordially
Pascal

"SDH" a écrit dans le message de news:
...
I have a lisbox(lboProduct) on a userform (UserForm3). The listbox
references
a list of products on a worksheet (Sheet1) in column A. In column B of
Sheet1
is the corresponding price of each product. The UserForm3 also has a
TextBox
(txtQuantity). I have a command button (cmdCost) that when clicked needs
to
show the total cost. Which is equal to the amount entered in txtQuantity *
the corresponding price of the product selected in the lboProducts.



  #5   Report Post  
Posted to microsoft.public.excel.programming
SDH SDH is offline
external usenet poster
 
Posts: 19
Default lisbox reference and calculation

thanks very much papou that works fine

"papou" wrote:

Hello
Create two names on sheet1:
"Product" to refer to product names in column A
"Price" to refer to prices in column B
Then in the CmdCost_CLick place this:

Private Sub CmdCost_Click()
If Me.txtQuantity.Value < "" Then
prod = Me.lboProduct.Value
Pprice = Application.WorksheetFunction.Index(Range("Price") _
, Application.WorksheetFunction.Match(prod, Range("Product"), 0))
MsgBox Pprice * txtQuantity
End If
End Sub

HTH
Cordially
Pascal

"SDH" a écrit dans le message de news:
...
I have a lisbox(lboProduct) on a userform (UserForm3). The listbox
references
a list of products on a worksheet (Sheet1) in column A. In column B of
Sheet1
is the corresponding price of each product. The UserForm3 also has a
TextBox
(txtQuantity). I have a command button (cmdCost) that when clicked needs
to
show the total cost. Which is equal to the amount entered in txtQuantity *
the corresponding price of the product selected in the lboProducts.






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
LisBox Column Width Abdul[_2_] Excel Programming 4 April 4th 06 07:16 AM
Can you do calculation for Row or Column for link reference first? KhaVu Excel Worksheet Functions 1 December 27th 05 08:57 PM
Cell reference based on calculation scott_ross_3 Excel Discussion (Misc queries) 3 October 14th 05 08:24 AM
Horizontal Scrollbar For Lisbox Justin Starnes[_2_] Excel Programming 5 October 20th 04 11:26 AM
LisBox List Abdul[_4_] Excel Programming 2 October 8th 03 05:08 PM


All times are GMT +1. The time now is 11:12 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"