Change text on excel sheet when changing in textbox in Userform

obiwann

Board Regular
Joined
Jan 2, 2014
Messages
142
I am having this problem

I have Userform with 1 Combox and 5 textboxes. When for example I select an Item in the combox and say the 1st textbox changes to "090123". When I change the number to "090129" it does not change in the corresponding cell in my worksheet. Here is my code:

Private Sub UserForm_Initialize()
Set xRg = Worksheets("My_Tables").Range("L2:Q7")
Me.ComboBox1.List = xRg.Columns(1).value
End Sub
Private Sub ComboBox1_Change()
Me.TextBox1.Text = Application.WorksheetFunction.VLookup(Me.ComboBox1.value, xRg, 2, False)
Me.TextBox2.Text = Application.WorksheetFunction.VLookup(Me.ComboBox1.value, xRg, 3, False)
Me.TextBox3.Text = Application.WorksheetFunction.VLookup(Me.ComboBox1.value, xRg, 4, False)
Me.TextBox4.Text = Application.WorksheetFunction.VLookup(Me.ComboBox1.value, xRg, 5, False)
Me.TextBox5.Text = Application.WorksheetFunction.VLookup(Me.ComboBox1.value, xRg, 6, False)
End Sub

Private Sub CommandButton1_Click()
Load Confirm_Update
End Sub
Private Sub CommandButton2_Click()
update_volume.hide
End Sub
Private Sub update_Click()
Dim answer As Integer
answer = MsgBox("Are you sure you want to update the Prover Volume.", vbYesNo + vbQuestion, "Update Prover Volume?")
If answer = vbYes Then
Unload update_volume
Else
End If
End Sub


Any help would be really appreciated.
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
1. View your form
2. Double-click the combobox
3. Enter this code, changing the name of the combobox, Wb, Ws, and cell as needed:
Code:
Wb.Ws.[A1].Value = Me.Combobx.Value
 
Upvote 0
Can you be more specific? I am not fluent in this vb coding stuff.

Sorry:(

What is the name of the worksheet with the cells you want to change?

Is that worksheet in the same workbook as your userform?

Finally, what is the name of your combobox?
 
Upvote 0
Its in the code

Set xRg = Worksheets("My_Tables").Range("L2:Q7")
Me.ComboBox1.List = xRg.Columns(1).value
 
Upvote 0
Its in the code

Set xRg = Worksheets("My_Tables").Range("L2:Q7")
Me.ComboBox1.List = xRg.Columns(1).value

When you view the userform in the VBA editor:
1. Double-click the ComboBox1
2. You are taken to the code editor under the Private Sub ComboBox1_Change()
3. Enter this code, change the range to your needs:
Rich (BB code):
ThisWorkbook.Worksheets("My_Tables").Range("L2").Value = Me.ComboBox1.Value
 
Upvote 0
When you view the userform in the VBA editor:
1. Double-click the ComboBox1
2. You are taken to the code editor under the Private Sub ComboBox1_Change()
3. Enter this code, change the range to your needs:
Rich (BB code):
ThisWorkbook.Worksheets("My_Tables").Range("L2").Value = Me.ComboBox1.Value

I think you have misunderstood my question.
The code I have so far works perfectly but the one thing I cannot get to work is for example lets say I select the name paul in my combobox.
The 1st textbox foe example will show his phone number.
When I go into the textbox to change is phone number, it allows me to do so but when I close the userform the phone number in my excel sheet did not change to the new number I entered into the textbox.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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