Hi there, I hope someone can help me with this, I'm pretty new to this VBA coding and I have been having trouble with this.
Basically I have a column filled with names (A) that the combobox is filled with, I then have a text based inputbox and a submit button.
Right now the submit button transfers the data from the inputbox to the same row depending on the combobox choice and edits the existing text which is fine.
However I also want the data to be submitted to another sheet where the data is not edited but added.
Example: I choose James from combobox and writes 10 in the inputbox, the submit button will then edit the existing value on the "Data Edit" sheet on the row James
and add the value to the row James on the "Data Add sheet".
This is the edit code, I basically just need some pointers as to how to add data to blank cells in corresponding rows according to combobox selection.
Public myRow As Long
Private Sub ComboBox1_Click()
myRow = Application.Match(Me.ComboBox1.Value, Sheets("DataEdit").Range("A:A"), 0)
Me.TextBox1.Value = Application.Index(Sheets("DataEdit").Columns(2), myRow)
End Sub
Private Sub CommandButton1_Click()
' Stores the name for search value
NameOrig = TextBox1.Value
'Finds the name from the dropdown and deletes it
With Worksheets("DataEdit").Range("A:A")
.Cells(myRow, 2).Value = TextBox1.Value
' etc.
End With
Unload Me
End Sub
Private Sub UserForm_Initialize()
For Each c In Worksheets("DataEdit").Range("A2", Range("A65000").End(xlUp))
Me.ComboBox1.AddItem c.Value
Next c
End Sub
Thanks beforehand, from a VBA noob
Bookmarks