Sure, you can if you want to. If we keep the code the same as you presented it, it would be:
Dim togs(1 To 6) As MSForms.ToggleButton
Dim i As Long
Set togs(1) = Toggle1
Set togs(2) = Toggle2
Set togs(3) = Toggle3
Set togs(4) = Toggle4
Set togs(5) = Toggle5
Set togs(6) = Toggle6
For i = LBound(togs) To UBound(togs)
If togs(i).Value Then
Range("A" & i).Value = "YAY"
Else
Range("B" & i).Value = "nay"
End If
Next i
There are various other options available to you too. For example, you could use the Userform's controls collection:
Dim i As Long
For i = 1 To 6
If Controls("ToggleButton" & CStr(i)).Value Then
Range("A" & i).Value = "YAY"
Else
Range("B" & i).Value = "nay"
End If
Next i
Bookmarks