を埋めるためにしようとしたとき、私はランタイム13エラーにファイル名を指定して実行時エラー「13」:型の不一致2つの別々のフィールドを移入しようとしている一方で、テキストボックス
を受けていますフィールドにテキストを追加するコードは
ですPrivate Sub cmdAddMDS_Click() SetText GetMDS(currentMDS, cboxMDS.Value) SetCat catMDS(currentMDS, cboxMDS.Value) <-- This creates the runtime error End Sub
潜水は同じ、ちょうど別のサブ名の近くにある加算する値を設定し、誰もが肝炎ん
Function GetMDS(mdsName As Worksheet, templateName As String) As String
Dim Lrow As Long, rng As Range
On Error Resume Next
Lrow = mdsName.Range("A" & Rows.Count).End(xlUp).row
With mdsName.Range("A2:A" & Lrow)
Set rng = .Find(templateName, LookIn:=xlValues)
If Not rng Is Nothing Then
GetMDS = rng.Offset(, 1).Value
End If
End With
End Function
----------------------------------------------------------
Function catMDS(mdsName As Worksheet, templateName As String) As String
Dim Lrow As Long, rng As Range
On Error Resume Next
Lrow = mdsName.Range("A" & Rows.Count).End(xlUp).row
With mdsName.Range("A2:A" & Lrow)
Set rng = .Find(templateName, LookIn:=xlValues)
If Not rng Is Nothing Then
catMDS = rng.Offset(, 3).Value
End If
End With
End Function
を相殺しますどのような洞察力がこのエラーの原因になっているのでしょうか?
を引き起こしていた二つの異なるパラメータに同じ名前を使用し、答えを考え出しsetCatの場合、セルの内容を次のようにテキストボックスに修正します。 'Sub SetCat(ByVal txt As String、オプションとして追加Boolean = False) txt = txt&vbNewLine&" ______________________________________ "&vbNewLine もしappend = True Then frmMDS.catMDS.Text =(frmMDS.catMDS.Text + vbNewLine)&txt Else frmMDS.catMDS.Text = txt 終了の場合 終了サブ ' – Jmcewen50