Msgbox行にアプリケーション定義またはオブジェクト定義のエラーが発生しました。私は両方のInputBox変数をStringとして宣言しています。シート(sheetname1)を実際のシート名に変更しようとしましたが、同じエラーが発生しました。私は知っているすべてを試しました、私はこのエラーに困惑しています。どんな助けもありがとうございます。Msgbox行のExcel VBAエラー
sheetname1 = Application.InputBox("Enter the name of your first sheet.")
sheetname2 = Application.InputBox("Enter the name of your second sheet.")
For i = 1 To 100
For j = 1 To 100
If Not Sheets(sheetname1).Cells(i, j).Value = Sheets(sheetname2).Cells(i, j).Value Then
Sheets(sheetname1).Select
Cells(i, j).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ans = MsgBox("Cells " & i & "," & j & " do not match." & vbNewLine & "The value on " & sheetname1 & " is " & Sheets(sheetname1).Cells(i, j).Value & " and the value on " & sheetname2 & " is " & Sheets("sheetname2").Cells(i, j).Value, vbOKCancel + vbQuestion)
If ans = vbCancel Then Exit Sub
Else
GoTo skip1
End If
skip1:
Next j
Next i
'Cells(i1、j1)'とはどういう意味ですか?それがあなたの問題です。それはちょうど 'セル(i、j)'であるべきですか?または 'セル(i&1、j&1)'? – BruceWayne
ありがとう@BruceWayne、あなたは素晴らしい目を持っています!それは、セル(i、j)であると考えられます。簡単な質問ですが、コメントに青色で強調表示されたコードタイプのテキストをどのように入力しますか? – Bubs
'\' backticks \ '' –