Consulting

Results 1 to 3 of 3

Thread: Excel VB Macro Help

  1. #1

    Excel VB Macro Help

    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.
    Last edited by Aussiebear; 09-09-2023 at 01:36 AM. Reason: Wrapped supplied code with code tags

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    x1Up
    Should be
    xlup

    In upper case that's from X1UP to XLUP.
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  3. #3
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,059
    Location
    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
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •