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!
Bookmarks