Asking for help with text box?

  • I need the code to use for a VBA textbox in excel.
    1. I want to scan a UPC code into a textbox then write the data to cell "a5"
    2. next enter a qty on hand into another text box and write this data to cell "b5"
    3. next repeat step 1- except write the UPC to the next available cell in column "A"
    4. next repeat step 2- except write the UPC to the next available cell in column "B"
    then repeat all steps and continue entering data in the empty cells



    example of what I have done already


    Thanks in advance for any help anyone can give me...I would really appreciate it.

  • Re: Asking for help with text box?


    This should do what you want.


    forum.ozgrid.com/index.php?attachment/64728/


    Enable Macro's..then click the Command Button on the main sheet. Enter in a UPC code and a QTY. Then click Enter.


    -Cheers :)




    Code for Userform...Just in case anyone is curious.


    Code
    Dim nextrow As Long
    nextrow = Cells(Rows.Count, "A").End(xlUp).Row + 1
    
    
    With Range("A" & nextrow)
       .Value = Me.TextBox1.Value 'UPC Textbox
       .Offset(0, 1).Value = Me.TextBox2.Value 'Qty Textbox
     End With
  • Re: Asking for help with text box?


    Also try


    Code
    Private Sub CommandButton1_Click()
    Sheet1.Cells(Rows.Count, 1).End(xlUp).Resize(, 2).Value = Array(Me.TextBox1.Value, Me.TextBox2.Value)
    End Sub

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!