+ Reply to Thread
Results 1 to 3 of 3

UserForm/ RowSource (using combo boxes)

Hybrid View

  1. #1
    Registered User
    Join Date
    01-24-2011
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    31

    UserForm/ RowSource (using combo boxes)

    Using a userform and need to user separate sheets in the workbook to accomplish the task. Code first:

    Dim ws As Worksheet
    Dim ws2 As Worksheet
    Dim ws3 As Worksheet
    Dim emptyRow As Long
    
    Set ws = Worksheets("Populated Shifts")
    Set ws2 = Worksheets("Event")
    Set ws3 = Worksheets("Volunteers")
    
    
    emptyRow = ws.Cells(ws.Rows.Count, 1).End(xlUp).Row + 1
    ws.Cells(emptyRow, 1).Value = Me.cmbVol1.Value
    ws.Cells(emptyRow, 2).Value = Me.cmbEventName.Value
    ws.Cells(emptyRow, 3).Value = Me.cmbStartTime.Value
    ws.Cells(emptyRow, 4).Value = Me.cmbEndTime.Value
    ws.Cells(emptyRow, 5).Value = ws2.Cells(Me.cmbEventName.RowSource, 1).Value
    ws.Cells(emptyRow, 7).Value = ws3.Cells(Me.cmbVol1.RowSource, 2).Value
    
    With ws
    If Me.cmbVol2.Value > "" Then
    emptyRow = .Cells(.Rows.Count, 1).End(xlUp).Row + 1
    .Cells(emptyRow, 1).Value = Me.cmbVol2.Value
    .Cells(emptyRow, 2).Value = Me.cmbEventName.Value
    .Cells(emptyRow, 3).Value = Me.cmbStartTime.Value
    .Cells(emptyRow, 4).Value = Me.cmbEndTime.Value
    .Cells(emptyRow, 5).Value = ws2.Cells(Me.cmbEventName.RowSource, 1).Value
    .Cells(emptyRow, 7).Value = ws3.Cells(Me.cmbVol2.RowSource, 2).Value
    End If
    The problem comes with adding to columns 5 and 7. I'm not sure I know how to properly use RowSource.

    Basically I need to get the row of the information from the selected choice in a combo box and then input into columns 5 and 7 different info from those rows. All on a different sheet.

    If you need more info let me know.

    Thanks.
    Last edited by Squirrel; 09-09-2011 at 10:26 AM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: UserForm/ RowSource (using combo boxes)

    Looks like you should be using ListIndex not RowSource. Remember ListIndex starts at zero so you must add 1
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    01-24-2011
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: UserForm/ RowSource (using combo boxes)

    ListIndex solved my problem...had to use +2 for it.
    Last edited by Squirrel; 09-09-2011 at 10:27 AM.

+ 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