Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
1476to1480
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

Liste mit Formeln in einzelne Tabellenbl. aufteile

Liste mit Formeln in einzelne Tabellenbl. aufteile
04.03.2016 10:40:00
Daniel
Hallo zusammen,
ich bräuchte etwas Hilfe, da ich nicht nur die absoluten Werte, sondern auch Formeln kopieren möchte.
Ich habe folgendes Makro zur Aufteilung einer Liste in neue Tabellenblätter in Verwendung. Die Auswahl der Spalte als Grundlage des Aufteilungsmerkmals benötige ich auch. Kann mir jemand helfen?
Sub KritToSheet()
Dim objShSource As Worksheet, objSh As Worksheet
Dim rng As Range, rngCopy As Range
Dim varTemp As Variant
Dim strFind As String, strFirst As String
Dim lngLast As Long, lngAct As Long
Dim rngCol As Range, intCol As Integer
On Error Resume Next
Set rngCol = Application.InputBox("Markieren Sie eine Zelle in der" & vbLf & _
"gewünschten Spalte! (Kriterium)", "Tabelle aufteilen", ActiveCell.Address, Type:=8)
If rngCol Is Nothing Then Exit Sub
intCol = rngCol(1).Column
On Error GoTo ErrExit
With Application
.ScreenUpdating = False
.EnableEvents = False
.DisplayAlerts = False
.Calculation = xlCalculationManual
.Cursor = xlWait
End With
rngCol.Parent.Copy After:=Sheets(Sheets.Count)
Set objShSource = Sheets(Sheets.Count)
With objShSource
lngLast = .Cells(Rows.Count, intCol).End(xlUp).Row
lngAct = lngLast
Do While lngAct > 1
strFind = .Cells(2, intCol)
Set rngCol = .Range(.Cells(2, intCol), .Cells(lngAct, intCol))
Set rng = rngCol.Find(what:=strFind, lookat:=xlWhole)
If Not rng Is Nothing Then
strFirst = rng.Address
Do
If rngCopy Is Nothing Then
Set rngCopy = .Rows(rng.Row)
Else
Set rngCopy = Union(rngCopy, .Rows(rng.Row))
End If
Set rng = rngCol.FindNext(rng)
Loop While Not rng Is Nothing And strFirst  rng.Address
End If
If Not rngCopy Is Nothing Then
Set objSh = Worksheets.Add(After:=Sheets(Sheets.Count))
On Error Resume Next
objSh.Name = strFind
If Err.Number  0 Then
objSh.Name = strFind & Format(Now, " hhmmss")
Err.Clear
End If
On Error GoTo ErrExit
rngCopy.Copy
objSh.Cells(2, 1).PasteSpecial xlValues
objSh.Cells(2, 1).PasteSpecial xlFormats
Application.CutCopyMode = False
objShSource.Rows(1).Copy objSh.Rows(1)
rngCopy.Delete
Set rngCopy = Nothing
Set objSh = Nothing
End If
lngAct = .Cells(Rows.Count, intCol).End(xlUp).Row
Loop
.Delete
End With
ErrExit:
Set objShSource = Nothing
Set rngCol = Nothing
With Application
.ScreenUpdating = True
.EnableEvents = True
.DisplayAlerts = True
.Calculation = xlCalculationAutomatic
.Cursor = xlDefault
End With
End Sub

Vielen Dank für die Hilfe.

1
Beitrag zum Forumthread
Beitrag zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Liste mit Formeln in einzelne Tabellenbl. aufteile
04.03.2016 14:51:54
Werner
Hallo Daniel,
wenn du hier meinst
anstatt das
objSh.Cells(2, 1).PasteSpecial xlValues
objSh.Cells(2, 1).PasteSpecial xlFormats
dieses
objSh.Cells(2, 1).PasteSpecial xlAll 'kopiert Formeln und Formatierungen
Wenn du hier meinst
anstatt das
objShSource.Rows(1).Copy objSh.Rows(1)
dieses
objShSource.Rows(1).Copy
objSh.Rows(1).PasteSpecial xlAll 'kopiert Formeln und Formatierungen
Wenn du nur die Formeln willst dann PasteSpecial xlFormulas
Gruß Werner
Anzeige

308 Forumthreads zu ähnlichen Themen

Anzeige
Anzeige
Anzeige

Links zu Excel-Dialogen

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige