AW: Alle Spalten außer X kopieren & Werte
18.02.2021 13:31:49
excelliebe
Hier mein Code bisher:
Sub HR()
Application.ScreenUpdating = False
Dim SpalteHQ As Range
Dim SpalteKatalog As Range
Dim letzteSpalte As Long
Dim letzteZeile As Range
letztZeile = Sheets("Blatt1").Cells(Rows.Count, "A").End(xlUp).Row
Sheets("Blatt1").Copy
'Spalten nach HQ löschen
With Worksheets("Blatt1")
letzteSpalte = .Cells(3, .Columns.Count).End(xlToLeft).Column
Set SpalteHQ = .Rows(3).Find(what:="HQ", LookIn:=xlValues, lookat:=xlWhole)
If Not SpalteHQ Is Nothing Then
If letzteSpalte > SpalteHQ.Column Then
.Range(.Cells(1, SpalteHQ.Column + 1), .Cells(1, letzteSpalte)).EntireColumn. _
Delete
End If
End If
End With
'Spalte vor Katalog absteigend sortieren
With Worksheets("Blatt1")
Set SpalteKatalog = .Rows(3).Find(what:="Katalog", LookIn:=xlValues, lookat:=xlWhole). _
Offset(, -1) 'Suche Spalte "Katalog" und gehe eins nach links
.Range(Cells(3, SpalteKatalog.Column), Cells(letztZeile, SpalteKatalog.Column)). _
Sort _
Key1:=Range(SpalteKatalog.Address), Order1:=xlDescending, _
Header:=xlYes
End With
'Farbig unterlegen
With Range(SpalteKatalog.Address).Interior
.Color = 10066431
End With
Application.ScreenUpdating = True
End Sub
Nach Kopieren des Tabellenblatts Blatt 1 würde ich gern die besagten Spalten als Wert einfügen und die Formeln rausnehmen.