+ Reply to Thread
Results 1 to 7 of 7

userForm assigning values

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    01-09-2009
    Location
    Cedar Hill, Tx
    MS-Off Ver
    Excel 2003
    Posts
    200

    Re: userForm assigning values

    Here's the code:

    Sub editRecord()
        Load UserForm1
        UserForm1.tbEditNew = "Edit"
        UserForm1.txtDate = ActiveCell.Value
        Select Case ActiveCell.Offset(0, 3).Value
            Case "Cedar Hill"
                UserForm1.selectCedarHill = True
                UserForm1.selectDeSoto = False
                UserForm1.selectLancaster = False
            Case "DeSoto"
                UserForm1.selectCedarHill = False
                UserForm1.selectDeSoto = True
                UserForm1.selectLancaster = False
            Case "Lancaster"
                UserForm1.selectCedarHill = False
                UserForm1.selectDeSoto = False
                UserForm1.selectLancaster = True
        End Select
        Select Case ActiveCell.Offset(0, 8)
            Case "AM only"
                UserForm1.obAMonly = True
                UserForm1.obAMPM = False
                UserForm1.obPMonly = False
            Case "AM / PM"
                UserForm1.obAMonly = False
                UserForm1.obAMPM = True
                UserForm1.obPMonly = False
            Case "PM only"
                UserForm1.obAMonly = False
                UserForm1.obAMPM = False
                UserForm1.obPMonly = True
        End Select
        UserForm1.lbSelectDriver.Value = ActiveCell.Offset(0, 2)
        driverID = ActiveCell.Offset(0, 1)
        If ActiveCell.Offset(0, 9) <> "" Then
            UserForm1.lbReasons.Value = ActiveCell.Offset(0, 9)
        End If
        If ActiveCell.Offset(0, 10) <> "" Then
            UserForm1.lbSelectStandbyAM.Value = ActiveCell.Offset(0, 10)
        End If
        If ActiveCell.Offset(0, 11) <> "" Then
            UserForm1.lbSelectStandbyMD.Value = ActiveCell.Offset(0, 11)
        End If
        If ActiveCell.Offset(0, 12) <> "" Then
            UserForm1.lbSelectStandbyPM.Value = ActiveCell.Offset(0, 12)
        End If
        If ActiveCell.Offset(0, 13) <> "" Then
            UserForm1.lbSelectStandbyOther.Value = ActiveCell.Offset(0, 13)
        End If
        UserForm1.Show
    End Sub
    I'm pulling a "record" from the worksheet, putting the data into the userForm and allowing the user to further edit the data.

    Bob

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,009

    Re: userForm assigning values

    Do any of the listboxes work properly? Do their change events affect each other? Are they bound to ranges on the worksheet?
    Everyone who confuses correlation and causation ends up dead.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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