Objektvariable/With-Blockvariable nicht festgelegt
19.03.2005 14:46:07
tom
bekomme o.g. Fehlermeldung.
Ich bastele gerade an einem Sortieren-Makro, das so ausschaut.
Sub Daten_sortieren()
Call ScreenAus
Range("A1").Select
Name1:
Columns("A:A").Select
Selection.Find(What:="Name", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
' Wenn "Name" nicht gefunden, dann gehe zur Sprungmarke "Company1"
' ansonsten gehe zur Sprungmarke "Name2":
If Selection.Find(What:="Name", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False) Is Nothing Then
GoTo Company1
Else
GoTo Name2
End If
Name2:
ActiveCell.ClearContents
' 2 Zellen nach unten springen:
ActiveCell.Offset(3, 0).Select
Selection.Copy
' In nächste freie Zelle der Spalte D springen:
Sheets("Nokia").Cells(Rows.Count, 4).End(xlUp)(2, 1).Select
ActiveSheet.Paste
Application.CutCopyMode = False
GoTo Name1
Company1:
Columns("A:A").Select
Selection.Find(What:="Company", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
If Selection.Find(What:="Company", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False) Is Nothing Then
GoTo JobTitle1
Else:
GoTo Company2
End If
Company2:
ActiveCell.ClearContents
ActiveCell.Offset(3, 0).Select
Selection.Copy
Sheets("Nokia").Cells(Rows.Count, 9).End(xlUp)(2, 1).Select
ActiveSheet.Paste
Application.CutCopyMode = False
GoTo Company1
JobTitle1:
Range("A1").Select
Call ScreenAn
End Sub
Wieso bekomme ich die Fehlermeldung. Welche Variable habe ich nicht
festgelegt?
Vielen Dank für Eure Zeit,
tom