Combox Box Data Put in Selected Rows

AsifShah

Board Regular
Joined
Feb 12, 2021
Messages
70
Office Version
  1. 2016
  2. 2013
Platform
  1. Windows
Dear Friends,

Im new in Excel VBA Coding and also my english is not good. I was made a Distribution Software in Ms Excel but now i want it simple.
In Excel File i Have ComboBox1 and i want to save my data as i want.
For Example: Some Names are in ComBoBox ( Coca Cola , Sprite , Fanta) in Difference types.
When i select Coca cola RGB 250ml in Combobox1 then TextBox1 Value save in Excel Worksheet2 ColumF7
When i select Coca cola PET 1500ML in Combobox2 then TextBox2 Value save in Excel Worksheet2 ColumJ7
When i select Coca cola RGB 2250ML in Combobox3 then TextBox3 Value save in Excel Worksheet2 ColumN7

I WANT TO ONLY SAVE JUST MY QTY IN EXCEL FILE.

UserForm.png




1613123717588.png
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Try this in the userform module:
VBA Code:
Private Sub TextBox1_Change()
    If ComboBox1.Value = "Coca cola RGB 250ml" Then
        Sheets(2).Range("F7").Value = TextBox1.Value
    End If
End Sub
Private Sub TextBox2_Change()
    If ComboBox2.Value = "Coca cola PET 1500ml" Then
        Sheets(2).Range("J7").Value = TextBox2.Value
    End If
End Sub
Private Sub TextBox3_Change()
    If ComboBox3.Value = "Coca cola RGB 2250ml" Then
        Sheets(2).Range("N7").Value = TextBox3.Value
    End If
End Sub
This code, though inflexible, pastes the value in a textbox into the cells if the value in the combobox adjacent to the textbox is matched.
Note that if you type "ml" in capital letters it won't work.
 
Upvote 0
Try this in the userform module:
VBA Code:
Private Sub TextBox1_Change()
    If ComboBox1.Value = "Coca cola RGB 250ml" Then
        Sheets(2).Range("F7").Value = TextBox1.Value
    End If
End Sub
Private Sub TextBox2_Change()
    If ComboBox2.Value = "Coca cola PET 1500ml" Then
        Sheets(2).Range("J7").Value = TextBox2.Value
    End If
End Sub
Private Sub TextBox3_Change()
    If ComboBox3.Value = "Coca cola RGB 2250ml" Then
        Sheets(2).Range("N7").Value = TextBox3.Value
    End If
End Sub
This code, though inflexible, pastes the value in a textbox into the cells if the value in the combobox adjacent to the textbox is matched.
Note that if you type "ml" in capital letters it won't work.
Dear,
Product List in ComboBox1 when i select Coca cola RGB 250m it save in to Excel F7 but when i Select Coca cola PET 1500ml in comobox1 and press save it not save in Excel Sheet J7 Colum.
Dear I Have Product Code Like Below. and i want to save these codes Qty (TextBox1) as i want.
100130 290130 190175 103541
When i 100130 Select in ComboBox1 then My TextBox1 data save in Excel Sheet F7
When i 19130 Select in ComboBox1 then My TextBox1 data save in Excel Sheet G7
When i 290130 Select in ComboBox1 then My TextBox1 data save in Excel Sheet G7
i have 30+ Product Code.
This UserForm is my Sale Invoice.
 
Upvote 0

Forum statistics

Threads
1,214,943
Messages
6,122,376
Members
449,080
Latest member
Armadillos

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top