Option Explicit Private Sub cmd初期化_Click() '初期化 With ActiveSheet .Range("MSG") = "" .初期化 End With End Sub Private Sub cmd確保条件_Click() With ActiveSheet .Range("MSG") = "" .条件設定_確保 SolverOptions , , , , , , , , , , , , , , , , , , , , TIME_NO_IMP_MAX SolverOkDialog SetCell:="目標_過不足", MaxMinVal:=2, ValueOf:=0, ByChange:="変化させるセル", Engine:=3, EngineDesc:="Evolutionary" If .Range("目標_過不足") = 0 Then .Range("MSG") = "確保成功" .cmd勤務色更新_Click End With End Sub Private Sub cmd日数調整条件_Click() With ActiveSheet .Range("MSG") = "" .条件設定_日数調整 SolverOkDialog SetCell:="目標_予定数差", MaxMinVal:=2, ValueOf:=0, ByChange:="変化させるセル", Engine:=3, EngineDesc:="Evolutionary" If .Range("目標_予定数差") = 0 Then .Range("MSG") = "調整成功" .cmd勤務色更新_Click End With End Sub Private Sub cmd均等再配置_Click() '均等再配置 With ActiveSheet ' If .Range("目標_予定数差") <> 0 Then ' MsgBox "目標_予定数が0になっていません。前段の処理から再度行って下さい。", vbOKOnly, "目_予定数差が0になっていません。" ' Exit Sub ' End If Call reAllocate("変化させるセル", "条件_最適化", "目標_最適化") '均等再配置 SetKinmuCellColor ActiveSheet.Range("出力") '勤務色更新 End With End Sub Private Sub cmdランダム入替_Click() With ActiveSheet Call randomReAllocate("変化させるセル", "条件_調整", 3) 'ランダム入れ替え .cmd勤務色更新_Click End With End Sub Private Sub cmd勤務色更新_Click() With ActiveSheet .cmd勤務色更新_Click End With End Sub Private Sub cmdSolverDialog_Click() 'ダイアログ With ActiveSheet .cmdSolverDialog_Click End With End Sub Private Sub cmd必須条件_Click() End Sub Private Sub cmd閉じる_Click() Unload Me End Sub Private Sub cmdGoSolver1_Click() 'ソルバー1実行 With ActiveSheet lblNote.Visible = True DoEvents .cmdGo_Click lblNote.Visible = False End With End Sub Private Sub cmdGoSolver2_Click() '勤務日数自動調整 With ActiveSheet .勤務日数自動調整 End With End Sub