If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Insert data in next blank cell using VB

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-14-04, 11:24
bertthefreak bertthefreak is offline
Registered User
 
Join Date: Dec 2003
Location: Belfast, UK
Posts: 87
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.
Reply With Quote
  #2 (permalink)  
Old 03-14-04, 12:40
Smitty Smitty is offline
Registered User
 
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On