+ Reply to Thread
Results 1 to 3 of 3

Specifying whether a set of combo boxes will enter data to a new row?

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    01-06-2012
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    165

    Specifying whether a set of combo boxes will enter data to a new row?

    Hi there, I have a basic userform with three comboboxes (WIDTH1,LENGTH1,HEIGHT1) . The users selections will be be sent over to the next empty row in sheet 2.
    I want to be able to have multiple sets of 3 comboboxes (in one userform), whereby data from each 'set' of comboxes will enter to the next empty row in Sheet 2. EG WIDTH2,LENGTH2,HEIGHT2 will go to a new row, and WIDTH3,LENGTH3,HEIGHT3 will be entered to a new row and so on.

    Any help as to how I might accomplish this would be much appreciated.
    Here is my current setup:


    Private Sub cmdAdd_Click()
    Dim iRow As Long
    Dim ws As Worksheet
    Set ws = Worksheets("SHEET2")
    
    With iRow = ws.Cells(Rows.Count, 1) _
      .End(xlUp).Offset(1, 0).Row
      
    ws.Cells(iRow, 1).Value = Me.COMBOBOXWIDTH1
    ws.Cells(iRow, 2).Value = Me.COMBOXBOXLENGTH1
    ws.Cells(iRow, 3).Value = Me.COMBOBOXHEIGHT1
    
      
    End Sub
    Last edited by BPSJACK; 07-18-2012 at 11:35 AM. Reason: Attempt to make things clearer

  2. #2
    Forum Contributor
    Join Date
    01-06-2012
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    165

    Re: Specifying whether a set of combo boxes will enter data to a new row?

    I've changed some of the wording hopefully it will be a bit clearer.

  3. #3
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: Specifying whether a set of combo boxes will enter data to a new row?

    Hello
    This is perhaps not very elegant and I've not tested it, unless I recreate your form but maybe something like:


    Dim iRow As Long
    Dim ws As Worksheet
    Set ws = Worksheets("SHEET2")
    
    With iRow = ws.Cells(Rows.Count, 1) _
      .End(xlUp).Offset(1, 0).Row
      
    ws.Cells(iRow, 1).Value = Me.COMBOBOXWIDTH1
    ws.Cells(iRow, 2).Value = Me.COMBOXBOXLENGTH1
    ws.Cells(iRow, 3).Value = Me.COMBOBOXHEIGHT1
    
    ws.Cells(iRow + 1, 1).Value = Me.COMBOBOXWIDTH2
    ws.Cells(iRow + 1, 2).Value = Me.COMBOXBOXLENGTH2
    ws.Cells(iRow + 1, 3).Value = Me.COMBOBOXHEIGHT2
    
    ws.Cells(iRow + 2, 1).Value = Me.COMBOBOXWIDTH3
    ws.Cells(iRow + 2, 2).Value = Me.COMBOXBOXLENGTH3
    ws.Cells(iRow + 2, 3).Value = Me.COMBOBOXHEIGHT3
    Hope this helps.
    DBY

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1