Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50057

Loop though CheckBoxs to see if check and return a value in a cell accordingly

$
0
0
Hello,

I am trying to have a Userform that pops up where the user then chooses a series of CheckBoxs then hits done and it will place a value ("Y") in that cell. It links off of another userform but I know that that one is not the issue. It doesn't tell me there is an error, It just doesn't change the cell Values. All my Checkboxs are named cb1,cb2,cb3,etc.

Code:

Private Sub cmdDone_Click()
Dim a As String, i As Variant

For i = 1 To 40
   
With Control("cb" & i)
    If .Value = 1 Then
        a = "Y"
    Else
        a = ""
    End If
End With

ActiveCell.Offset(0, (26 + i)).Value = a

Next i

Me.Hide

End Sub

Any help would be great!

Viewing all articles
Browse latest Browse all 50057

Trending Articles