| 
    
     |  | こんにちは。私は、マクロの全くの初心者ですが、地元地区の役員を任せられたので、日々の収入支出表入力をダイアログより入力しようと本の例題を参考にしながら、只今、エクセルにチャレンジ中で、途中ですが、下記のプログラムを作成しました。ですが、「kigou = Application.WorksheetFunction.VLookup(Trim(Str(TextBox4)), Trim(Str(Worksheets("分類").Range("分分類"))), 3, False)」のところでエラ−になり、色々調べてもチンプンカンプンでわかりません。 誰か、どのようにしたら良いか教えて下さいませんか?
 
 
 Private Sub TextBox12_Click()
 '------------------------------------
 '登録ボタンによる処理
 '-----------------------------------
 
 
 'シ−トの保護を解除する
 sheets("台帳").Unprotect
 '最下行に1行挿入する
 insertRow = Range("収入支出台帳").Rows.Count
 Range("収入支出台帳").Rows(insertRow).Insert Shift:=xlDown
 'デ−タをセルに入力する
 '年月日
 gousei = "平成" & TextBox1.Text & "年" & TextBox2.Text & "月" & TextBox3.Text & "日"
 Range("収入支出台帳").Cells(insertRow, 1) = gousei
 
 '分類
 Range("収入支出台帳").Cells(insertRow, 7) = TextBox4.Text
 kigou = sheets("台帳").Range("収入支出台帳").Cells(insertRow, 2)
 bunnrui = sheets("台帳").Range("収入支出台帳").Cells(insertRow, 7)
 
 '記号分類
 kigou = Application.WorksheetFunction.VLookup(Trim(Str(TextBox4)), Trim(Str(Worksheets("分類").Range("分分類"))), 3, False)
 '収入先、支出先
 
 Select Case Range("収入支出台帳").Cells(insertRow, 4)
 Case kigou >= 12
 Range("収入支出台帳").Cells(insertRow, 4) = TextBox5.Text
 Case 34 <= kigou.Text <= 35
 Range("収入支出台帳").Cells(insertRow, 4) = TextBox5.Text
 Case Else
 Range("収入支出台帳").Cells(insertRow, 4) = ""
 End Select
 Select Case Range("収入支出台帳").Cells(insertRow, 5)
 Case kigou >= 12
 Range("収入支出台帳").Cells(insertRow, 5) = ""
 Case 34 <= kigou.Text <= 35
 Range("収入支出台帳").Cells(insertRow, 5) = ""
 Case Else
 Range("収入支出台帳").Cells(insertRow, 5) = TextBox5.Text
 End Select
 '金額
 Range("収入支出台帳").Cells(insertRow, 3) = TextBox6.Text
 '収入金額、支出金額
 Select Case Range("収入支出台帳").Cells(insertRow, 8)
 Case kigou >= 12
 Range("収入支出台帳").Cells(insertRow, 8) = TextBox6.Text
 Case 34 <= kigou.Text <= 35
 Range("収入支出台帳").Cells(insertRow, 8) = TextBox6.Text
 Case Else
 Range("収入支出台帳").Cells(insertRow, 8) = ""
 End Select
 Select Case Range("収入支出台帳").Cells(insertRow, 9)
 Case kigou >= 12
 Range("収入支出台帳").Cells(insertRow, 9) = ""
 Case 34 <= kigou.Text <= 35
 Range("収入支出台帳").Cells(insertRow, 9) = ""
 Range("収入支出台帳").Cells(insertRow, 9) = TextBox6.Text
 End Select
 
 
 '備考
 Range("収入支出台帳").Cells(insertRow, 6) = TextBox7.Text
 'シ−トを保護する
 
 sheets("台帳").Protect
 'ダイアログを閉じる
 
 |  |