Private Sub CommandButton1_Click()
Dim i As Long
Dim strResult As String
Dim wb As Workbook
Set wb = ThisWorkbook
For i = 1 To 3
If Controls("OptionButton" & i).Value = True Then
strResult = Controls("OptionButton" & i).Caption
End If
Next
If strResult = "" Then
MsgBox "実行タイプを選択してください"
Else
wb.Sheets("Sheet1").Range("B3") = strResult
wb.Save
wb.Close
Set wb = Nothing
Unload Me
End If
End Sub
Private Sub UserForm_Initialize()
Application.Visible = False
End Sub
Private Sub UserForm_Terminate()
’もとに戻す
Application.Visible = True
End Sub
ray88.hatenablog.com