Hi Leute,
anhand dieses Codes möchte ich gerne harte Werte (also ohne Formel) in eine neue Datei extrahieren..
Der Code funktioniert, nur leider kopiert es die Formeln mit.. Weiß jmd Rat?
hier der Code:
Public Sub Export_XLPH()
Dim Blatt As Worksheet
Dim aBlattNamen() As String
Dim lngIndex As Long
Dim Pfad As String
Pfad = ThisWorkbook.Path & "\" & "Export"
ReDim aBlattNamen(0 To ThisWorkbook.Worksheets.Count - 1)
For Each Blatt In ThisWorkbook.Worksheets
Select Case Blatt.Name
Case "Tabelle100", "Tabelle101" ' hier Ausnahmen auflisten
Case Else
aBlattNamen(lngIndex) = Blatt.Name
lngIndex = lngIndex + 1
End Select
Next
Set Blatt = Nothing
If lngIndex = 0 Then
MsgBox "Keine Blätter zum Exportieren gefunden!"
Exit Sub
End If
Application.ScreenUpdating = False
ReDim Preserve aBlattNamen(0 To lngIndex - 1)
ThisWorkbook.Worksheets(aBlattNamen).Copy
For Each Blatt In ActiveWorkbook.Worksheets
With Blatt.UsedRange
.Copy
.Cells(1).PasteSpecial xlPasteValues
Application.Goto .Cells(1)
End With
Next
Set Blatt = Nothing
Application.CutCopyMode = False
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs Pfad, ThisWorkbook.FileFormat
Application.DisplayAlerts = True
ActiveWorkbook.Close False
Application.ScreenUpdating = True
MsgBox "Export-Datei wurde ersteltt in:" & vbLf & vbLf & Pfad & ".???"
End Sub
|