So habe ich ein Problem in Bezug auf ein Arbeitsblatt. Ich beabsichtige, ein Eingabefeld zu öffnen, wenn ich in der Arbeitsmappe eine leere Zelle in Spalte B finde, damit ich den leeren Zellenwert eingeben und ändern kann. Ich bin jedoch einen Fehler bekommen (Erste Abonnement außer Reichweite sagte, und ich änderte es, jetzt heißt es application/Objekt definiert Fehler) auf dieser Linie:
For i = 0 To Sheets(j).Cells(Rows.Count, i).End(xlUp).Row
Mit Bezug auf Arbeitsblatt
Code:
Dim Country As Variant
Dim Capital As Variant
Dim CapitalValue As Variant
Dim i As Integer
Dim j As Integer
' Select *first line of data*
Range("B1").Select
' Loop to stop when an empty cell is reached.
For j = 1 To Worksheets.Count
j = ActiveSheet.Index
Range("B1").Select
For i = 0 To Sheets(j).Cells(Rows.Count, i).End(xlUp).Row
'Select the Country Cell
ActiveCell.Offset(i, 0).Select
CapitalValue = ActiveCell.Value
'If Country is empty
If CapitalValue = "" Then
MsgBox ("No more Capitals")
Else
'Input Capital values
CapitalValue = ActiveCell.Value
Country = ActiveCell.Offset(0, -1).Value
Capital = InputBox("Capital of " & Country, "Capital Input")
CapitalValue = Capital
End If
Next i
Next j
Grüße
Ich denke, es ist weil du ich verwenden zweimal 'Für i = 0 To Sheets (j) .Cells (Rows.Count, intColNumber ) .End (xlUp) .Row' –
Die Sheets(). Cells() -Methode muss Argumente größer als 0 haben. 'Sheets (j) .Cells (Rows.Count , i +1) .End (xlUp) .Row' – JerryT