То, что я пытаюсь достичь, - создать пользовательскую форму, которую я вызываю в Sheet1, но результаты из формы пользователя VBA должны идти в строки листа 2 без ее открытия. Однако я не могу этого добиться, когда я сохраняю записи, всплывает лист 2. Любая идея, как его решить? Большое спасибо.VBA User Form issue select wrong sheet
Private Sub CommandButton1_Click()
Dim emptyRow As Long
'Make Sheet2 active
Sheets("Sheet2").Activate
'Determine emptyRow
emptyRow = WorksheetFunction.CountA(Range("A:A")) + 1
'Transfer information
Cells(emptyRow, 1).Value = TextBox1.Value
Cells(emptyRow, 2).Value = TextBox2.Value
If OptionButton1.Value = True Then
Cells(emptyRow, 3).Value = OptionButton1.Caption
End If
If OptionButton2.Value = True Then
Cells(emptyRow, 3).Value = OptionButton2.Caption
End If
If OptionButton3.Value = True Then
Cells(emptyRow, 3).Value = OptionButton3.Caption
End If
If CheckBox1.Value = True Then Cells(emptyRow, 4).Value = CheckBox1.Caption
If CheckBox2.Value = True Then Cells(emptyRow, 4).Value = Cells(emptyRow, 4).Value & " " & CheckBox2.Caption
If CheckBox3.Value = True Then Cells(emptyRow, 4).Value = Cells(emptyRow, 4).Value & " " & CheckBox3.Caption
If CheckBox4.Value = True Then Cells(emptyRow, 4).Value = Cells(emptyRow, 4).Value & " " & CheckBox4.Caption
If CheckBox5.Value = True Then Cells(emptyRow, 4).Value = Cells(emptyRow, 4).Value & " " & CheckBox5.Caption
Cells(emptyRow, 4).Value = Cells(emptyRow, 4).Value & " " & TextBox3.Value
If CheckBox6.Value = True Then Cells(emptyRow, 5).Value = CheckBox6.Caption
If CheckBox7.Value = True Then Cells(emptyRow, 5).Value = Cells(emptyRow, 5).Value & " " & CheckBox7.Caption
If CheckBox8.Value = True Then Cells(emptyRow, 5).Value = Cells(emptyRow, 5).Value & " " & CheckBox8.Caption
'ewwrewerwerwe
If OptionButton7.Value = True Then
Cells(emptyRow, 6).Value = OptionButton7.Caption
End If
If OptionButton8.Value = True Then
Cells(emptyRow, 6).Value = OptionButton8.Caption
End If
If OptionButton9.Value = True Then
Cells(emptyRow, 6).Value = OptionButton9.Caption
End If
'werwewewewe
If OptionButton10.Value = True Then
Cells(emptyRow, 7).Value = OptionButton10.Caption
End If
If OptionButton11.Value = True Then
Cells(emptyRow, 7).Value = OptionButton11.Caption
End If
If OptionButton12.Value = True Then
Cells(emptyRow, 7).Value = OptionButton12.Caption
End If
'ewrweewwerew
If OptionButton13.Value = True Then
Cells(emptyRow, 8).Value = OptionButton13.Caption
End If
If OptionButton14.Value = True Then
Cells(emptyRow, 8).Value = OptionButton14.Caption
End If
If OptionButton15.Value = True Then
Cells(emptyRow, 8).Value = OptionButton15.Caption
End If
If OptionButton16.Value = True Then
Cells(emptyRow, 8).Value = OptionButton16.Caption
End If
If OptionButton17.Value = True Then
Cells(emptyRow, 8).Value = OptionButton17.Caption
End If
'werwerwerwe
If OptionButton18.Value = True Then
Cells(emptyRow, 9).Value = OptionButton18.Caption
End If
If OptionButton19.Value = True Then
Cells(emptyRow, 9).Value = OptionButton19.Caption
End If
If OptionButton20.Value = True Then
Cells(emptyRow, 9).Value = OptionButton20.Caption
End If
If OptionButton21.Value = True Then
Cells(emptyRow, 9).Value = OptionButton21.Caption
End If
If OptionButton22.Value = True Then
Cells(emptyRow, 9).Value = OptionButton22.Caption
End If
End Sub
Ваша первая команда: 'Таблицы (« Лист2 »). Активировать' покажет вам Sheet2. –