Hello,
im not sure how to code this (obviously lol).
i have a simple user form that has 1 combox that lists all items in column a. I have a text box that lists the text in column next to it (column b). what im not sure how to do is to let the user type in a new item into the combobox and text box and add it to the list or to have the user change the info in the text box and have it update in the corisponding excel sheet. below is the code I have for selecting the column and text box.
just don't know what to write to let them change the info in the cells.
I also have set up that the value in the combobox is stored in cell gg1 but im not sure if its just the face value or the actual row/column location value.
Private Sub UserForm_Initialize()
Dim i As Long
Dim LastRow As Long
Dim ws As Worksheet
Set ws = Sheets("Sheet1")
LastRow = ws.range("A" & Rows.Count).End(xlUp).Row
For i = 4 To LastRow
Me.ComboBox1.AddItem ws.Cells(i, "A").Value
Next i
Application.WindowState = xlMinimized
End Sub
Private Sub ComboBox1_Change()
Dim i As Long
Dim LastRow As Long
Dim ws As Worksheet
Set ws = Sheets("Sheet1")
LastRow = ws.range("A" & Rows.Count).End(xlUp).Row
For i = 4 To LastRow
If (Me.ComboBox1.Value) = ws.Cells(i, "A") Then
Me.TextBox1 = ws.Cells(i, "B").Value
End If
ws.range("gg1").Value = Me.ComboBox1.Value = x
Next i
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Application.WindowState = xlNormal
End Sub
any help is greatly appreciated.
im not sure how to code this (obviously lol).
i have a simple user form that has 1 combox that lists all items in column a. I have a text box that lists the text in column next to it (column b). what im not sure how to do is to let the user type in a new item into the combobox and text box and add it to the list or to have the user change the info in the text box and have it update in the corisponding excel sheet. below is the code I have for selecting the column and text box.
just don't know what to write to let them change the info in the cells.
I also have set up that the value in the combobox is stored in cell gg1 but im not sure if its just the face value or the actual row/column location value.
Private Sub UserForm_Initialize()
Dim i As Long
Dim LastRow As Long
Dim ws As Worksheet
Set ws = Sheets("Sheet1")
LastRow = ws.range("A" & Rows.Count).End(xlUp).Row
For i = 4 To LastRow
Me.ComboBox1.AddItem ws.Cells(i, "A").Value
Next i
Application.WindowState = xlMinimized
End Sub
Private Sub ComboBox1_Change()
Dim i As Long
Dim LastRow As Long
Dim ws As Worksheet
Set ws = Sheets("Sheet1")
LastRow = ws.range("A" & Rows.Count).End(xlUp).Row
For i = 4 To LastRow
If (Me.ComboBox1.Value) = ws.Cells(i, "A") Then
Me.TextBox1 = ws.Cells(i, "B").Value
End If
ws.range("gg1").Value = Me.ComboBox1.Value = x
Next i
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Application.WindowState = xlNormal
End Sub
any help is greatly appreciated.