Excel Userform VBA help

getafix33

Expert Member
Joined
Nov 16, 2006
Messages
1,803
Reaction score
83
Hi

I am trying to create a userform to input data into an Excel spreadsheet.

I have created a command click button called Submit.

The code for the button is below

Private Sub CommandButton1_Click()
Dim lastrow As Long
lastrow = Sheets("StockSheet").Range("Stock" & Rows.Count).End(x1Up).Row + 1, "Stock").Value = TextBox1.text

End Sub

Stocksheet = the sheet name
Stock = Column named Stock
TextBox1 = the text box created in the userform

I get a compile syntax error
 
Top
Sign up to the MyBroadband newsletter
X