Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel VBA - Userform Textbox Manipulation

Hey People!

Total newbie to this sort of thing, so could do with a bit of basi
help...

The problem I have concerns 8 textboxs in a userform controlled by
spinbutton. they contain quantities of an item to be purchased. What
need to do is to have the quantities of all eight, multiplied by price
specific to the item...

e.g. textbox1*11 etc

and then have the total of these 8 sums displayed in another blan
textbox

Apoligies if very basic, but i'm working against the clock

Many thanks,

Rosco

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Excel VBA - Userform Textbox Manipulation

Hi Roscoe

Not basic. Textboxes have Text properties, which are String variables. You
need something like Val to make them numbers -assuming also that reasonable
digits are entered.

Textbox9.Text = Val(TextBox1.Text) * 11 + _
Val(TextBox2.Text) * 12 + _
Val(TextBox3.Text) * 13 + _
Val(TextBox4.Text) * 14 + _
Val(TextBox5.Text) * 15 + _
Val(TextBox6.Text) * 16 + _
Val(TextBox7.Text) * 17 + _
Val(TextBox8.Text) * 18

HTH. Best wishes Harald

"roscoe " skrev i melding
...
Hey People!

Total newbie to this sort of thing, so could do with a bit of basic
help...

The problem I have concerns 8 textboxs in a userform controlled by a
spinbutton. they contain quantities of an item to be purchased. What I
need to do is to have the quantities of all eight, multiplied by prices
specific to the item...

e.g. textbox1*11 etc

and then have the total of these 8 sums displayed in another blank
textbox

Apoligies if very basic, but i'm working against the clock

Many thanks,

Roscoe


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Excel VBA - Userform Textbox Manipulation

You don't say how to get the price for the specific item, so here is a guess

Dim tbox as MSforms.Textbox
Dim item as MSforms.Label
for i = 1 to 8
set tbox = Userform1.Controls("TextBox" & i)
set item = Userform1.Controls("Label" & i)
price = application.Vlookup(item,Worksheets("Costs").Range ("A1:B2000"),0)
qty = clng(Tbox.Text)
'tbox1.Text = price * qty
tot = tot + price * qty
Next
Textbox9.Text = tot


--
Regards,
Tom Ogilvy


"roscoe " wrote in message
...
Hey People!

Total newbie to this sort of thing, so could do with a bit of basic
help...

The problem I have concerns 8 textboxs in a userform controlled by a
spinbutton. they contain quantities of an item to be purchased. What I
need to do is to have the quantities of all eight, multiplied by prices
specific to the item...

e.g. textbox1*11 etc

and then have the total of these 8 sums displayed in another blank
textbox

Apoligies if very basic, but i'm working against the clock

Many thanks,

Roscoe


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel VBA - Userform Textbox Manipulation

Thanks Harold

Question, if I copy and paste your code in to the code for the blan
txtbox (i.e. textbox9) and replace the names and prices with the ones
have, should that work?


Thanks Tom

The prices I have are just made up numbers, they're not in an
worksheet or anything, i'd just want to be able to put in any number.
have no idea behind the concept of what you've written proving m
newbie status, any chance it could be "dummed down"? I'm very muc
still learning.

could you write where the prices would be as "price1" "price2" etc


Thanks again guy

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Excel VBA - Userform Textbox Manipulation

Use Harald's. It is as "dumbed down" as anything I could come up with.

As far as where to put it, when do you want it to fire. Putting it in the
code for Textbox9 wouldn't seem appropriate - in fact you shouldn't be using
a textbox for the sum since you want to publish a result, not allow the user
to interact with it. A label is more appropriate.

You could put the code in the Click event for Textbox8 or put a
commandbutton on the form and put it in the click event for the
commandbutton.

--
Regards,
Tom Ogilvy

"roscoe " wrote in message
...
Thanks Harold

Question, if I copy and paste your code in to the code for the blank
txtbox (i.e. textbox9) and replace the names and prices with the ones I
have, should that work?


Thanks Tom

The prices I have are just made up numbers, they're not in any
worksheet or anything, i'd just want to be able to put in any number. I
have no idea behind the concept of what you've written proving my
newbie status, any chance it could be "dummed down"? I'm very much
still learning.

could you write where the prices would be as "price1" "price2" etc


Thanks again guys


---
Message posted from http://www.ExcelForum.com/





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Excel VBA - Userform Textbox Manipulation

"Tom Ogilvy" skrev i melding
...
Use Harald's. It is as "dumbed down" as anything I could come up with.


LOL. Thanks Tom :-)

Best wishes Harald


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel VBA - Userform Textbox Manipulation

I know it's been a while but just saying thanks for solving m
problems!!!

cheers,

Rosco

--
Message posted from http://www.ExcelForum.com

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
how do i format a textbox on a userform created in excel Bert New Users to Excel 1 May 5th 08 11:46 PM
Excel VBA - Userform textbox formatting thesteelmaker[_4_] Excel Programming 1 March 3rd 04 08:51 PM
Excel VBA - Userform Checkbox/Textbox Problem Thunder5 Excel Programming 1 February 16th 04 02:06 PM
UserForm TextBox to ActiveSheet TextBox over 256 characters Dan E[_2_] Excel Programming 1 July 28th 03 07:36 PM
Direct manipulation of TextBox Mike NG Excel Programming 4 July 13th 03 01:15 AM


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