hilfe bei der Änderung von VBA code
30.07.2005 21:35:59
VBA
Folgender Cod steht in dieser Arbeitsmappe unter BeforeClose
Option Explicit
Const TBL_SOURCE = "Herstelldiff."
Const RNG = "A1:R40"
Const PFAD = "Monat2.xls"
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim TBL_TARGET As String
TBL_TARGET = Sheets("Herstelldiff.").[t1]
Dim Wb As Workbook, Ws As Worksheet
ActiveWorkbook.Save
On Error Resume Next
Set Ws = Sheets(TBL_SOURCE): Set Wb = Workbooks.Open(FileName:=PFAD, UpdateLinks:=0)
If Err.Number <> 0 Then Set Ws = Nothing: MsgBox "Datei für Übertrag nicht gefunden! Bitte Meister informieren!", vbCritical: Exit Sub
Ws.Range(RNG).Copy Destination:=Wb.Sheets(TBL_TARGET).Cells(Range(RNG).Row, Range(RNG).Column)
Application.CutCopyMode = False
Wb.Close Savechanges:=True: Set Ws = Nothing: Set Wb = Nothing:
End Sub
Er kopiert die komplette Tabelle in eine neue Datei.
Nun möchte ich, dass nur die Werte eingefügt werden.
Mit dem Rekorder bekomme ich das nicht gebacken.
Vielen Dank im Vorraus
Norbert