Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2003
    Location
    Belfast, UK
    Posts
    87

    Unanswered: Insert data in next blank cell using VB

    I've created a userform that allows the user to select items to and place then on an invoice. When the user clicks add the item details are entered in row 19, the next item should be added to the next row. How can I do this using VB?

    Maximum row is 38.

  2. #2
    Join Date
    Dec 2003
    Location
    San Diego, CA
    Posts
    153
    Here's one way starting from A19. It assumes that you have a Command Button used to update the invoice and that you're using Combo Boxes. You'll need to ammend the code to include all of your boxes or the particular controls that you're using:
    Code:
    Private Sub CommandButton1_Click()
        Dim LastRow As Object
            Set LastRow = Sheets("Sheet1").Range("A38").End(xlUp)
            
        With LastRow
            .Offset(1, 0) = ComboBox1
            .Offset(1, 1) = ComboBox2
            '   Repeat As Necessary
            '   Code will not continue past Row 38
        End With
    
    End Sub
    Hope that helps,

    Smitty

Posting Permissions

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