Anzeige
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender

Forumthread: Letzte Zeile markieren

Letzte Zeile markieren
16.01.2006 11:48:24
Zergio
Hallo hab da ein kleines Makro geschrieben mit dem ich eine spezielle Spalte(ICSN) markiere und dann in die letzte Zeile mit Eintrag gehen möchte.
Ist wohl ein bisschen umständlich geschrieben und gibt mir auch nen Compilierungsfehler bei "Application.Goto Cells(lonCol, 65536), True". Bin nur "Amateur" und versteh hier meinen Fehler nicht. Das kann man bestimmt auch mit ActiveCell."...".select oder .activate machen, weiss aber nicht wie.
Kann mir jemand helfen.

Sub Workbook_Open()
Dim lonCol As Long, lonRow As Long
Sheets("DATA BASE").Activate
' Find unique identification "ICSN"
Cells.Find(What:="ICSN", After:=ActiveCell, LookIn:=xlValues, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True).Activate
' Save Column of "ICSN"
lonCol = ActiveCell.Column
' Goto end of Column (Last entry)
Application.Goto Cells(lonCol, 65536), True   <========
Selection.End(xlUp).Select
lonRow = Selection.Row
' Select the Row underneath and replace format of the following ten columns
ActiveCell.Offset(1, 0).Rows("1:1").EntireRow.Select
Selection.Copy
ActiveCell.Offset(1, 0).Rows("1:10").EntireRow.Select
Selection.Paste
Application.CutCopyMode = False
Application.Goto Cells(lonRow, lonCol), True
ActiveSheet.Outline.ShowLevels RowLevels:=0, ColumnLevels:=1
End Sub

Anzeige

2
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Letzte Zeile markieren
16.01.2006 12:12:51
Harald
Hallo zergio,
bisserl bizarr isses schon ;-))
lonRow = cells(rows.count, lonCol).end(xlup).row 'letzte Zeile mit Eintrag
cells(lonRow, lonCol). usw...
rows(lonRow). usw...
Gruss Harald
AW: Letzte Zeile markieren
16.01.2006 14:07:35
Zergio
Habe es jetzt so umgeschrieben und es klappt. Trotzdem "Vielen Dank" für deine Hilfe.
Aber da war keine Aktivierung der letzten Reihe drin um dann den end(xlup) befehl richtig ausführen zu können. (Glaub ich, soweit ich das verstehe). Ist zwar jetzt immernoch bizzar aber hoffe mal das sich das keiner anguckt ;))
Sub Workbook_Open()
Dim lonCol As Long, lonRow As Long
Sheets("DATA BASE").Activate
'Close Groups (Overview)
ActiveSheet.Outline.ShowLevels RowLevels:=0, ColumnLevels:=1
' Find unique identification "ICSN"
Cells.Find(What:="ICSN", After:=ActiveCell, LookIn:=xlValues, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True).Activate
' Save Column of "ICSN"
lonCol = ActiveCell.Column
' Goto end of Column (Last entry)
Application.Cells(65536, lonCol).Select
Selection.End(xlUp).Select
lonRow = ActiveCell.Row
' Select the Row underneath and replace format, validation of the following ten columns
ActiveCell.Offset(1, 0).Rows("1:1").EntireRow.Select
Selection.Copy
ActiveCell.Offset(1, 0).Rows("1:10").EntireRow.Select
ActiveSheet.Paste
Application.CutCopyMode = False
Application.Goto Cells(lonRow + 1, lonCol)
Anzeige
;

Forumthreads zu verwandten Themen

Anzeige
Anzeige
Anzeige
Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige