Change Values in TextBox to Change Cell Value

imav

New Member
Joined
Jun 27, 2011
Messages
21
Hey all,

I have written the code below to (from a ComboBox filled with the values in column A) Fill a series of TextBoxes with information from cells in the same row as the value (Selcted from the ComboBox).

The code works fine however I also need to be able to change the values that appear in the TextBoxes and have the actual cell change Also.
Basically I want to be able to manage my spreadsheet entirely from this Userform.

Code:
Private Sub CommandButton1_Click()
TextBox1.Value = Worksheets("RLATAM").Columns(1).Find(ComboBox1.Value).Offset(0, 1).Value
TextBox2.Value = Worksheets("RLATAM").Columns(1).Find(ComboBox1.Value).Offset(0, 16).Value
TextBox3.Value = Worksheets("RLATAM").Columns(1).Find(ComboBox1.Value).Offset(0, 17).Value
TextBox4.Value = Worksheets("RLATAM").Columns(1).Find(ComboBox1.Value).Offset(0, 18).Value
TextBox5.Value = Worksheets("RLATAM").Columns(1).Find(ComboBox1.Value).Offset(0, 19).Value
TextBox6.Value = Worksheets("RLATAM").Columns(1).Find(ComboBox1.Value).Offset(0, 20).Value
TextBox7.Value = Worksheets("RLATAM").Columns(1).Find(ComboBox1.Value).Offset(0, 21).Value
TextBox8.Value = Worksheets("RLATAM").Columns(1).Find(ComboBox1.Value).Offset(0, 22).Value
TextBox9.Value = Worksheets("RLATAM").Columns(1).Find(ComboBox1.Value).Offset(0, 23).Value
TextBox10.Value = Worksheets("RLATAM").Columns(1).Find(ComboBox1.Value).Offset(0, 24).Value
TextBox11.Value = Worksheets("RLATAM").Columns(1).Find(ComboBox1.Value).Offset(0, 25).Value
TextBox12.Value = Worksheets("RLATAM").Columns(1).Find(ComboBox1.Value).Offset(0, 59).Value
TextBox13.Value = Worksheets("RLATAM").Columns(1).Find(ComboBox1.Value).Offset(0, 60).Value
End Sub
 
Private Sub UserForm_Initialize()
    Dim wsSheet As Worksheet
    Dim rngNext As Range
    Dim myRange As Range
    Set wsSheet = ActiveSheet
    With wsSheet
        Set rngNext = .Range("A65536").End(xlUp)
    End With
    rngNext.Select
    Set myRange = Range("A5", rngNext)
    With ComboBox1
    For Each rngNext In myRange
        If rngNext <> "" Then .AddItem rngNext
    Next rngNext
End With
End Sub

So I have a ComboBox that is filled by the values in column A
when the Command Button is Clicked it fills All 13 TextBoxes with the information relevant to the ComboBox Selection.

All values are in the same row as the ComboBox Referace

Thanks in Advance

--imav
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

Forum statistics

Threads
1,224,564
Messages
6,179,543
Members
452,924
Latest member
JackiG

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