| 
    
     |  | ElseIf ComboBox2.Text = Worksheets("Sheet1").Range("B12").Value Then UserForm1.CheckBox1.Value = False '大工
 UserForm1.CheckBox2.Value = False '基礎
 UserForm1.CheckBox3.Value = False '電気
 UserForm1.CheckBox4.Value = False '水道
 UserForm1.CheckBox5.Value = False '屋根
 UserForm1.CheckBox6.Value = False '板金
 UserForm1.CheckBox7.Value = False '左官
 UserForm1.CheckBox8.Value = False '石
 UserForm1.CheckBox9.Value = False 'タイル
 UserForm1.CheckBox10.Value = False 'ガラス
 UserForm1.CheckBox11.Value = False '建具
 UserForm1.CheckBox12.Value = False '内装
 UserForm1.CheckBox13.Value = False '畳
 UserForm1.CheckBox14.Value = False '塗装
 UserForm1.CheckBox15.Value = False '磨き
 UserForm1.CheckBox16.Value = False 'ガス
 UserForm1.CheckBox17.Value = False '住設
 UserForm1.CheckBox18.Value = False '仮設トイレ
 UserForm1.CheckBox19.Value = False '外構
 UserForm1.CheckBox20.Value = False 'FRP
 UserForm1.CheckBox21.Value = False 'ウレタン
 UserForm1.CheckBox22.Value = False '消毒
 UserForm1.CheckBox23.Value = False '清掃
 UserForm1.CheckBox24.Value = False '足場
 UserForm1.CheckBox25.Value = False 'コンクリート
 UserForm1.CheckBox26.Value = False '鉄骨
 UserForm1.CheckBox27.Value = False '野村商店
 UserForm1.CheckBox28.Value = False '材木1
 UserForm1.CheckBox29.Value = False '材木2
 UserForm1.CheckBox30.Value = False '材木3
 UserForm1.CheckBox31.Value = False '照明
 UserForm1.CheckBox32.Value = False '金物
 UserForm1.CheckBox33.Value = False 'レッカー
 UserForm1.CheckBox34.Value = False 'コンテナ
 UserForm1.CheckBox35.Value = False '設計
 
 TextBox1.Value = Worksheets("Sheet1").Range("N12").Value '備考
 TextBox4.Value = Worksheets("Sheet1").Range("I12").Value '日にち
 
 ElseIf ComboBox2.Text = Worksheets("Sheet1").Range("B13").Value Then
 UserForm1.CheckBox1.Value = False '大工
 UserForm1.CheckBox2.Value = False '基礎
 UserForm1.CheckBox3.Value = False '電気
 UserForm1.CheckBox4.Value = False '水道
 UserForm1.CheckBox5.Value = False '屋根
 UserForm1.CheckBox6.Value = False '板金
 UserForm1.CheckBox7.Value = False '左官
 UserForm1.CheckBox8.Value = False '石
 UserForm1.CheckBox9.Value = False 'タイル
 UserForm1.CheckBox10.Value = False 'ガラス
 UserForm1.CheckBox11.Value = False '建具
 UserForm1.CheckBox12.Value = False '内装
 UserForm1.CheckBox13.Value = False '畳
 UserForm1.CheckBox14.Value = False '塗装
 UserForm1.CheckBox15.Value = False '磨き
 UserForm1.CheckBox16.Value = False 'ガス
 UserForm1.CheckBox17.Value = False '住設
 UserForm1.CheckBox18.Value = False '仮設トイレ
 UserForm1.CheckBox19.Value = False '外構
 UserForm1.CheckBox20.Value = False 'FRP
 UserForm1.CheckBox21.Value = False 'ウレタン
 UserForm1.CheckBox22.Value = False '消毒
 UserForm1.CheckBox23.Value = False '清掃
 UserForm1.CheckBox24.Value = False '足場
 UserForm1.CheckBox25.Value = False 'コンクリート
 UserForm1.CheckBox26.Value = False '鉄骨
 UserForm1.CheckBox27.Value = False '野村商店
 UserForm1.CheckBox28.Value = False '材木1
 UserForm1.CheckBox29.Value = False '材木2
 UserForm1.CheckBox30.Value = False '材木3
 UserForm1.CheckBox31.Value = False '照明
 UserForm1.CheckBox32.Value = False '金物
 UserForm1.CheckBox33.Value = False 'レッカー
 UserForm1.CheckBox34.Value = False 'コンテナ
 UserForm1.CheckBox35.Value = False '設計
 
 TextBox1.Value = Worksheets("Sheet1").Range("N13").Value '備考
 TextBox4.Value = Worksheets("Sheet1").Range("I13").Value '日にち
 
 End If
 
 
 For i = 1 To 35
 If Me.Controls("CheckBox" & i).Value = True Then 'チェック判定
 Me.Controls("CheckBox" & i).ForeColor = &HFF&
 Else
 Me.Controls("CheckBox" & i).ForeColor = &H0&
 End If
 Next i
 
 
 End Sub
 
 Private Sub CommandButton1_Click()
 
 Worksheets("FAX送信のご案内").Range("H12").Value = ComboBox1.Value '送信者転記
 Worksheets("FAX送信のご案内").Range("C16").Value = ComboBox2.Value '用件転記
 Worksheets("FAX送信のご案内").Range("A19").Value = TextBox4.Value '日にち項目転記
 Worksheets("FAX送信のご案内").Range("C20").Value = TextBox1.Value '備考転記
 Worksheets("FAX送信のご案内").Range("C21").Value = TextBox2.Value '備考転記
 Worksheets("FAX送信のご案内").Range("C23").Value = TextBox3.Value '備考転記
 Worksheets("FAX送信のご案内").Range("C19").Value = Format(Calendar1.Value, "ggge年mm月dd日(aaa)") 'カレンダーから摘出
 Worksheets("FAX送信のご案内").Range("C17").Value = TextBox7.Value + "邸 新築工事" '工事名転記
 Worksheets("FAX送信のご案内").Range("C18").Value = TextBox8.Value '工事場所転記
 Worksheets("FAX送信のご案内").Range("H17").Value = TextBox9.Value '監督名転記
 
 If Calendar1.Visible = Falsee Then '工事開始のお知らせ
 
 Worksheets("FAX送信のご案内").Range("C19:I19").ClearContents
 Else
 Calendar1.Visible = True
 
 End If
 
 
 Dim myMSG As String
 Dim myFlg As Boolean
 Dim x As Long
 Dim r As Long
 Dim c As Long
 Dim z As Long
 Dim i As Long
 
 i = SpinButton1.Value - 1
 myFlg = False
 Sheets("FAX送信のご案内").Range("B2:I10").ClearContents
 
 
 For x = 1 To 35 'チェックボックスの番号
 If Me.Controls("CheckBox" & x).Value = True Then
 myMSG = myMSG & Me.Controls("CheckBox" & x).Caption & vbCrLf
 myFlg = True
 z = z + 1
 r = ((z - 1) \ 4) + 2
 c = (((z - 1) Mod 4) + 1) * 2
 Sheets("FAX送信のご案内").Cells(r, c).Value = Sheets("新築工事台帳").Cells(i, x + 5).Value
 End If
 Next x
 
 If myFlg = True Then
 myMSG = myMSG & "宛てで宜しいですか?"
 If MsgBox(myMSG, vbInformation + vbYesNo) = vbYes Then
 Me.Hide
 ActiveWindow.ActiveSheet.PrintPreview
 Me.Show vbModeless
 End If
 Else
 myMSG = "いずれにもチェックが入っていません"
 MsgBox myMSG
 End If
 
 End Sub
 
 Private Sub CommandButton2_Click()
 
 Worksheets("FAX送信のご案内").PrintOut
 
 End Sub
 
 
 Private Sub UserForm_initialize()
 
 With ComboBox1
 .AddItem "Aさん"
 .AddItem "Bさん"
 .AddItem "Cさん"
 .AddItem "Dさん"
 .AddItem "Eさん"
 .AddItem "Fさん"
 .AddItem "Gさん"
 .AddItem "Hさん"
 .AddItem "Iさん"
 .AddItem "Jさん"
 .AddItem "Kさん"
 .AddItem "Lさん"
 End With
 
 ComboBox2.RowSource = "Sheet1!B1:B12"
 
 Set TBL(1) = TextBox6
 Set TBL(2) = TextBox7
 Set TBL(3) = TextBox8
 Set TBL(4) = TextBox9
 ElseIf ComboBox2.Text = Worksheets("Sheet1").Range("B11").Value Then '引渡の取扱説明依頼
 UserForm1.CheckBox1.Value = False '大工
 UserForm1.CheckBox2.Value = False '基礎
 UserForm1.CheckBox3.Value = True '電気
 UserForm1.CheckBox4.Value = True '水道
 UserForm1.CheckBox5.Value = False '屋根
 UserForm1.CheckBox6.Value = False '板金
 UserForm1.CheckBox7.Value = False '左官
 UserForm1.CheckBox8.Value = False '石
 UserForm1.CheckBox9.Value = False 'タイル
 UserForm1.CheckBox10.Value = True 'ガラス
 UserForm1.CheckBox11.Value = False '建具
 UserForm1.CheckBox12.Value = False '内装
 UserForm1.CheckBox13.Value = False '畳
 UserForm1.CheckBox14.Value = False '塗装
 UserForm1.CheckBox15.Value = False '磨き
 UserForm1.CheckBox16.Value = True 'ガス
 UserForm1.CheckBox17.Value = True '住設
 UserForm1.CheckBox18.Value = False '仮設トイレ
 UserForm1.CheckBox19.Value = False '外構
 UserForm1.CheckBox20.Value = False 'FRP
 UserForm1.CheckBox21.Value = False 'ウレタン
 UserForm1.CheckBox22.Value = False '消毒
 UserForm1.CheckBox23.Value = False '清掃
 UserForm1.CheckBox24.Value = False '足場
 UserForm1.CheckBox25.Value = False 'コンクリート
 UserForm1.CheckBox26.Value = False '鉄骨
 UserForm1.CheckBox27.Value = False '野村商店
 UserForm1.CheckBox28.Value = False '材木1
 UserForm1.CheckBox29.Value = False '材木2
 UserForm1.CheckBox30.Value = False '材木3
 UserForm1.CheckBox31.Value = False '照明
 UserForm1.CheckBox32.Value = False '金物
 UserForm1.CheckBox33.Value = False 'レッカー
 UserForm1.CheckBox34.Value = False 'コンテナ
 UserForm1.CheckBox35.Value = False '設計
 
 TextBox1.Value = Worksheets("Sheet1").Range("N11").Value '備考
 TextBox4.Value = Worksheets("Sheet1").Range("I11").Value '日にち
 
 Set shデータ = Worksheets("新築工事台帳")
 レコード数 = shデータ.Range("A1").CurrentRegion.Rows.Count - 1
 If レコード数 = 0 Then
 MsgBox "データがないので実行できませんよ〜〜"
 SpinButton1.Enabled = False
 Exit Sub
 End If
 
 With SpinButton1
 .Max = レコード数
 .Min = 1
 End With
 
 Calendar1.Value = Date
 
 End Sub
 
 Public Function レコード数取得() As Long
 
 レコード数取得 = Worksheets("新築工事台帳").Range("A1").CurrentRegion.Rows.Count - 1
 
 End Function
 
 Private Sub データ表示(x As Long)
 
 TextBox5.Value = x & "/" & レコード数
 TextBox6.Value = shデータ.Range("A" & x + 1).Value
 TextBox10.Value = Worksheets("新築工事台帳").Cells(SpinButton1.Value, 41).Value
 
 End Sub
 
 Private Sub SpinButton1_Change()
 
 データ表示 SpinButton1.Value
 
 End Sub
 
 
 Private Sub ComboBox2_Click()
 If ComboBox2.Text = Worksheets("Sheet1").Range("B1").Value Then '工事開始のお知らせ
 Calendar1.Visible = False
 Worksheets("FAX送信のご案内").Range("C19:I19").ClearContents
 Else
 Calendar1.Visible = True
 End If
 
 End Sub
 
 |  |