As stated in the title. I just want to copy any item I click on in the Combobox1 dropdown list on Userform1 to the first blank row of Sheet2 the moment the item in Combobox1 is clicked. Seems simple enough.
Both Sheets 1 and 2 have just two columns of data; Headers: Col A = Item, Col B = Amount. 'Combobox1 Rowsource = =Sheet1!A2:B20
Below is what I have so far:
I may have left something out that's not copying the value in col B to Sheet2.
Thanks for anyone's help. I know this is something simple I'm missing.
cr.
[/code]
The problem with the code above is that it only copies the value in col A, - it doesn't copy the value amount on that same row to col B
of Sheet2.
Both Sheets 1 and 2 have just two columns of data; Headers: Col A = Item, Col B = Amount. 'Combobox1 Rowsource = =Sheet1!A2:B20
Below is what I have so far:
Code:
Private Sub ComboBox1_Click()
Dim x
x = Me.ComboBox1.Column(0) ' col A is the Item 'Me = Userform1
Y = Me.ComboBox1.Column(1) 'col B is the Amount ' Both x and Y are row values in Sheet1, the values to copy
Dim LastRow As Long, cellData As Variant
With Worksheets("Sheet2") 'the sheet to be copied to. Both values in cols A and B of Sheet1 must be copied.
LastRow = .Range("A" & .Rows.count).End(xlUp).Row + 1
.Range("A" & CStr(LastRow)).value = x 'cellData ' this only copies the value in col A
End With
End Sub
Thanks for anyone's help. I know this is something simple I'm missing.
cr.
[/code]
The problem with the code above is that it only copies the value in col A, - it doesn't copy the value amount on that same row to col B
of Sheet2.