PDA

View Full Version : Excel VB Macro Help



MacroMan00
09-08-2023, 01:07 PM
I have the following code but when I run it I get an error that says, "Run-time error '1004': Application-defined or object-defined error.


Private Sub CommandButton1_Click()
erow = Sheets("sheet1").Range("a" & Rows.Count).End(x1Up).Row
Range("a" & erow + 1) = TextBox1.Value
Range("b" & erow + 1) = TextBox2.Value
Range("c" & erow + 1) = TextBox3.Value
Range("d" & erow + 1) = TextBox4.Value
Range("e" & erow + 1) = TextBox5.Value
TextBox1.Value = ""
TextBox2.Value = ""
TextBox3.Value = ""
TextBox4.Value = ""
TextBox5.Value = ""
End Sub



Please help, thank you.

p45cal
09-08-2023, 04:07 PM
x1Up
Should be
xlup

In upper case that's from X1UP to XLUP.

Aussiebear
09-09-2023, 01:38 AM
Welcome to VBAX MacroMan00. When supplying code to the forum, please wrap them with code tags. See the first line in my signature for a hint