PC Review


Reply
Thread Tools Rate Thread

combobox and userform help!

 
 
dawn
Guest
Posts: n/a
 
      11th Oct 2006
Hey...
So I am having a lot of trouble writing a code for excel vba. I
created a user form with a combo box, two textboxes, and a button. I
figured out how to fill the combobox when the form loads already. I
have a worksheet in excel with a column for descriptions and a column
with the quanity corresponding to each item description. What I am
trying to do, is when the user selects an option from the
combobox(which is populated with the item description), and enters a
quantity in the first textbox, I want excel to add that quantity to the

corresponding quantity of the description already listed. I need it to

add the quanity to the corresponding excel cell and to the second
textbox on the form. I hope I explained what I am looking for clearly.

THanks in advance for any help as I am seriously stuck!

 
Reply With Quote
 
 
 
 
=?Utf-8?B?SkxHV2hpeg==?=
Guest
Posts: n/a
 
      11th Oct 2006
One post would normally be sufficient.

"dawn" wrote:

> Hey...
> So I am having a lot of trouble writing a code for excel vba. I
> created a user form with a combo box, two textboxes, and a button. I
> figured out how to fill the combobox when the form loads already. I
> have a worksheet in excel with a column for descriptions and a column
> with the quanity corresponding to each item description. What I am
> trying to do, is when the user selects an option from the
> combobox(which is populated with the item description), and enters a
> quantity in the first textbox, I want excel to add that quantity to the
>
> corresponding quantity of the description already listed. I need it to
>
> add the quanity to the corresponding excel cell and to the second
> textbox on the form. I hope I explained what I am looking for clearly.
>
> THanks in advance for any help as I am seriously stuck!
>
>

 
Reply With Quote
 
=?Utf-8?B?SkxHV2hpeg==?=
Guest
Posts: n/a
 
      11th Oct 2006
Disregard the last message.

"dawn" wrote:

> Hey...
> So I am having a lot of trouble writing a code for excel vba. I
> created a user form with a combo box, two textboxes, and a button. I
> figured out how to fill the combobox when the form loads already. I
> have a worksheet in excel with a column for descriptions and a column
> with the quanity corresponding to each item description. What I am
> trying to do, is when the user selects an option from the
> combobox(which is populated with the item description), and enters a
> quantity in the first textbox, I want excel to add that quantity to the
>
> corresponding quantity of the description already listed. I need it to
>
> add the quanity to the corresponding excel cell and to the second
> textbox on the form. I hope I explained what I am looking for clearly.
>
> THanks in advance for any help as I am seriously stuck!
>
>

 
Reply With Quote
 
Tom Ogilvy
Guest
Posts: n/a
 
      11th Oct 2006

Assume you fill your combobox with data from Sheet1!A11:A110

Private Sub Combobox1_Click()
Dim rng as Range, rng1 as Range
Dim res as Variant
With Worksheets("Sheet1")
set rng = .Range("A11:A110")
End With

res = Appliction.Match(Combobox1.Value,rng,0)
if not iserror(res) then
set rng1 = rng(res).Offset(0,1)
if isnumeric(Userform1.Textbox1.Value) then
rng1.Value = rng1.Value & cDbl(Userform1.Textbox1.Value)
Userform1.Textbox2.Value = rng1.Value
end if
End if

End Sub


--
Regards,
Tom Ogilvy



"dawn" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hey...
> So I am having a lot of trouble writing a code for excel vba. I
> created a user form with a combo box, two textboxes, and a button. I
> figured out how to fill the combobox when the form loads already. I
> have a worksheet in excel with a column for descriptions and a column
> with the quanity corresponding to each item description. What I am
> trying to do, is when the user selects an option from the
> combobox(which is populated with the item description), and enters a
> quantity in the first textbox, I want excel to add that quantity to the
>
> corresponding quantity of the description already listed. I need it to
>
> add the quanity to the corresponding excel cell and to the second
> textbox on the form. I hope I explained what I am looking for clearly.
>
> THanks in advance for any help as I am seriously stuck!
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
userform combobox Jonathan Microsoft Outlook VBA Programming 1 25th May 2010 02:32 AM
combobox in userform bernd Microsoft Excel Programming 1 15th Jun 2007 02:12 AM
Userform w/ComboBox =?Utf-8?B?RC5QYXJrZXI=?= Microsoft Excel Misc 2 6th May 2005 04:28 PM
ComboBox on UserForm Michel Microsoft Excel Programming 3 1st Aug 2004 11:10 PM
ComboBox on UserForm Michel Microsoft Excel Programming 2 31st Jul 2004 10:11 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:40 AM.