Alexandra20
New Member
- Joined
- May 24, 2021
- Messages
- 7
- Office Version
- 365
- Platform
- Windows
Hello, I am trying to make this code work:
Private Sub commandB_Click()
If Cells(ActiveCell.Row, "G") = "Výtah" Then
realita.vytah.Value = True
End If
If Cells(ActiveCell.Row, "G") = "Konstrukce" Then
realita.konstrukce.Value = True
End If
............ other similar IF functions .............
userForm.Show
End Sub
It is supposed to open the user form with checkboxes named: "Výtah", "Konstrukce",... and many more, however, some of them should be already checked according to what is written in the active cell (in the column G).
BTW, the G column has the text string in this form - Výtah, Konstrukce, other words (it could be also blank or there could be only one option written, in that case, there is no comma).
Why is the code not working?
Private Sub commandB_Click()
If Cells(ActiveCell.Row, "G") = "Výtah" Then
realita.vytah.Value = True
End If
If Cells(ActiveCell.Row, "G") = "Konstrukce" Then
realita.konstrukce.Value = True
End If
............ other similar IF functions .............
userForm.Show
End Sub
It is supposed to open the user form with checkboxes named: "Výtah", "Konstrukce",... and many more, however, some of them should be already checked according to what is written in the active cell (in the column G).
BTW, the G column has the text string in this form - Výtah, Konstrukce, other words (it could be also blank or there could be only one option written, in that case, there is no comma).
Why is the code not working?