I would like to overwrite data using a Userform, I can call the data to the form based on a Combobox (unique reference from column A in my data sheet). I am failing to send updated data back, and am stuck on a Run-time error '13.
I have looked at a number of posts but cannot pick out a thread to success! Any help appreciated. I have left the code simple, to update the 4 column of that row. Ultimately I will expand from the 2nd column onwards.
Private Sub cmbtrade_Change() - this part works as expected Dim trade_name As String If Me.cmbtrade.Value = "" Then MsgBox "Trade Can Not be Blank!!!", vbExclamation, "Trade" Exit Sub End If trade_name = cmbtrade.Value On Error Resume Next Dim trade As Double trade_name = cmbtrade.Value TextBox16.Text = Application.WorksheetFunction.VLookup(trade_name, Sheets("Sheet2").Range("A2:D43"), 4, False) End Sub
The problem part....
Private Sub cmdupdate_Click() If Me.cmbtrade.Value = "" Then MsgBox "Trade Name Can Not be Blank", vbExclamation, "Trade" Exit Sub End If trade_name = cmbtrade.Value Sheets("sheet2").Select Dim rowselect As Double rowselect = Me.cmbtrade.Value (this is where my mismatch error occurs) rowselect = rowselect + 1 Rows(rowselect).Select Cells(rowselect, 4) = Me.TextBox16.Value End Sub