+ Reply to Thread
Results 1 to 2 of 2

Option Button selection into column

Hybrid View

  1. #1
    Registered User
    Join Date
    06-05-2007
    Posts
    81

    Option Button selection into column

    Hello all! I need just a little finish work. I need the option button value ("StateName") to be placed in the selected cell (that will be in column "B"). I think I'm close I just can't get the rest of the way. The frame with the option buttons is on the form "frmCommits" and I don't know how to relate the code here to that form. This code is in a module.

    I also need to know if this code will automatically go to the active sheet or do I need to name it? (I have several sheets in my workbook.)

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
        If Target.Column <> Columns("B").Column Then Exit Sub
        State_Click
    End Sub
    
    Private Sub State_Click()
        Dim StateName As String
        If ObCa.Value = False _
            And ObIN.Value = False _
            And ObFL.Value = False _
            And ObID.Value = False _
            And ObMA.Value = False _
            And ObLA.Value = False _
            And ObNC.Value = False _
            And ObND.Value = False _
            And ObCT.Value = False Then
            MsgBox ("You must select a state.")
            ObCa.Set Focus
    Else
        If ObCa.Value = True Then
            StateName = "CA"
        ElseIf ObIN.Value = True Then
            StateName = "IN"
        ElseIf ObFL.Value = True Then
            StateName = "FL"
        ElseIf ObID.Value = True Then
            StateName = "ID"
        ElseIf ObMA.Value = True Then
            StateName = "MA"
        ElseIf ObLA.Value = True Then
            StateName = "LA"
        ElseIf ObNC.Value = True Then
            StateName = "NC"
        ElseIf ObND.Value = True Then
            StateName = "ND"
        ElseIf ObCT.Value = True Then
            StateName = "CT"
        End If
    End Sub
    Thank you, thank you!

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Option Button selection into column

    Hello pprseller,

    To get a quicker answer, I think you should post your workbook for review.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

+ 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