「ByRef引数の型が一致しません」・・・orz
お世話になります。
一昨日からエクセルのVBAをやりはじめたのですが、
表題のエラーが回避できなくて困っております。
下記のコードの
Sub 繰越判定(cellno1 As Long, cellno2 As Long, cellno3 As Long, kamoku As String, bunrui As String, karikatakamoku As String, kasikatakamoku As String, tekiyou As String, kurikosi As Long)
の行が黄色になり、そこから17行下の
Call 当期(cellno1, cellno2, cellno3, kamoku, bunrui, karikatakamoku, kasikatakamoku, tekiyou, kurikosi)
のtekiyouの部分が青く変わります。
お分かりになる方がいらっしゃいましたら
お助けください。
以下コードです。
Sub 総勘定元帳() '開始行の設定
Dim cellno1 As Long '総勘定元帳の開始行
Dim cellno2 As Long 'マスタの検索行
Dim cellno3 As Long 'データの検索開始行
Dim kamoku As String 'マスタの科目
Dim bunrui As String 'マスタの(科目の)分類
Dim karikatakamoku As String
Dim kasikatakamoku As String
Dim tekiyou As String
Dim kurikosi As Long
cellno1 = 5
kurikosi = 0
kamoku = Sheets("マスタ").Range("B3")
bunrui = Sheets("マスタ").Range("C3")
Call 繰越判定(cellno1, cellno2, cellno3, kamoku, bunrui, karikatakamoku, kasikatakamoku, tekiyou, kurikosi)
End Sub
Sub 繰越判定(cellno1 As Long, cellno2 As Long, cellno3 As Long, kamoku As String, bunrui As String, karikatakamoku As String, kasikatakamoku As String, tekiyou As String, kurikosi As Long)
cellno2 = 3 'マスタの開始行数セット
cellno3 = 5 'データの開始行数セット
kamoku = Sheets("マスタ").Range("B" & cellno2)
karikatakamoku = Sheets("データ").Range("F" & cellno3)
tekiyou = Sheets("データ").Range("G" & cellno3)
kasikatakamoku = Sheets("データ").Range("H" & cellno3)
'MsgBox kamoku
'MsgBox karikatakamoku
'MsgBox tekiyou
'MsgBox kasikatakamoku
If kurikosi = 0 Then '前期繰越か当期かの判定
Call 繰越(cellno1, cellno2, cellno3, kamoku, bunrui, karikatakamoku, kasikatakamoku, tekiyou, kurikosi)
Else
Call 当期(cellno1, cellno2, cellno3, kamoku, bunrui, karikatakamoku, kasikatakamoku, tekiyou, kurikosi)
End If
End Sub
Sub 繰越(cellno1 As Long, cellno2 As Long, cellno3 As Long, kamoku As String, bunrui As String, karikatakamoku As String, kasikatakamoku As String, tekiyou As String, kurikosi As Long)
Range("a1") = kamoku '科目タイトル出力
Range("C" & cellno1) = "前期繰越"
If bunrui = "資産" Or bunrui = "資産2" Or bunrui = "収益" Then '科目分類の判定
Set マスタ = Sheets("決算")
Set 範囲 = マスタ.Range("A68:B90")
Range("D" & cellno1) = Application.WorksheetFunction.VLookup(bunrui, 範囲, 2)
End If
Call 当期(cellno1, cellno2, cellno3, kamoku, bunrui, karikatakamoku, kasikatakamoku, tekiyou, kurikosi)
End Sub
Sub 当期(cellno1 As Long, cellno2 As Long, cellno3 As Long, kamoku As String, karikatakamoku As String, kasikatakamoku As String, tekiyou As String, kurikosi As Long)
Do Until cellno3 = 30
If kurikosi = 0 Then
Select Case kamoku
Case karikatakamoku
MsgBox karikatakamoku
cellno3 = cellno3 + 1
karikatakamoku = Sheets("データ").Range("F" & cellno3)
karikatakamoku = Sheets("データ").Range("F" & cellno3)
Case kasikatakamoku
MsgBox kasikatakamoku
cellno3 = cellno3 + 1
kasikatakamoku = Sheets("データ").Range("H" & cellno3)
karikatakamoku = Sheets("データ").Range("F" & cellno3)
Case Else
cellno3 = cellno3 + 1
karikatakamoku = Sheets("データ").Range("F" & cellno3)
kasikatakamoku = Sheets("データ").Range("H" & cellno3)
MsgBox cellno3
End Select
Loop
End Sub
お礼