我有一个VBA代码,它曾经在Excel 2010中运行得很好,它在Excel 2013中给我一个错误。这是一段代码
Sub Testfälle_Part_1()
Dim j As Integer
Dim i As Integer
Dim testfallname As String
Dim rng As Range
Dim Object As String
Dim Objectvalue As String
Dim rngObject1 As Range
Dim rngObject2 As Range
Application.ScreenUpdating = False
Sheets("Testfall-Input_Vorschlag").Activate
For j = 7 To 1000
If Sheets("Testfall-Input_Vorschlag").Cells(1, j) = "ARB11" Then
Set rng = Sheets("1-BR_Vorschlag").Range("G5:JG5").Find(testfallname)
End If
'Leistungsverlauf 122
Object = Sheets("Testfall-Input_Vorschlag").Cells(122, 3)
If WorksheetFunction.CountIf(Sheets("1-BR_Vorschlag").Range("C33:C97"), Object) > 0 Then
Set rngObject1 = Sheets("Testfall-Input_Vorschlag").Range("C122").Find(Object)
If Sheets("Testfall-Input_Vorschlag").Cells(rngObject1.Row, j) <> "" Then
Objectvalue = Sheets("Testfall-Input_Vorschlag").Cells(rngObject1.Row, j)
Set rngObject2 = Sheets("1-BR_Vorschlag").Range("F33:F97").Find(Objectvalue)
Sheets("1-BR_Vorschlag").Cells(rngObject2.Row, rng.Column).Value = "x"
End If
End If
'Produkttyp 123
Object = Sheets("Testfall-Input_Vorschlag").Cells(123, 3)
If WorksheetFunction.CountIf(Sheets("1-BR_Vorschlag").Range("C56:C58"), Object) > 0 Then
Set rngObject1 = Sheets("Testfall-Input_Vorschlag").Range("C123").Find(Object)
If Sheets("Testfall-Input_Vorschlag").Cells(rngObject1.Row, j) <> "" Then
Objectvalue = Sheets("Testfall-Input_Vorschlag").Cells(rngObject1.Row, j)
Set rngObject2 = Sheets("1-BR_Vorschlag").Range("F56:F58").Find(Objectvalue)
Sheets("1-BR_Vorschlag").Cells(rngObject2.Row, rng.Column).Value = "x"
With Sheets("1-BR_Vorschlag").Cells(rngObject2.Row, rng.Column).Interior
.Color = 13434828
End With
End If
End If
If Sheets("1-BR_Vorschlag").Cells(56, rng.Column).Value = "x" Then
With Sheets("1-BR_Vorschlag").Cells(rngObject2.Row, rng.Column).Interior
.Color = 10092543
End With
End If
Next j
End Sub
当我运行上面的代码时。它给出了一个错误对象变量或没有在行
设置块Sheets("1-BR_Vorschlag").Cells(rngObject2.Row, rng.Column).Value = "x"
以前用Excel 2010运行得很好.Excel 2013不支持什么。有人可以给我输入吗?谢谢