Habe letzt unterstehende Code vom Tino erhalten er kopiert das aktive Tabelleblatt in eine neue mappe und löscht alle Spalte die mit eine X markiert sind. Dass geht auch richtig spitze.
Habe aber eine sache vergessen, alle makro's in sich Tabelleblatt befinden werden mit kopiert ( _
Privat
Sub Change ereignis).
Frage ist wie kan man dass unterbinden sodass makro's vom tabelleblatt nicht mitkopiert werden.
Option Explicit
Sub CopyWithShapes()
Dim varCol
Dim iCalc As Integer, oShape As Shape
With Application
iCalc = .Calculation
.ScreenUpdating = False
.EnableEvents = False
.Calculation = xlCalculationManual
ActiveSheet.Copy
With ActiveSheet
For Each oShape In .Shapes
If oShape.Type = msoPicture Then
oShape.OnAction = ""
Else
oShape.Delete
End If
Next oShape
.Name = ThisWorkbook.ActiveSheet.Range("J1")
With ActiveSheet.UsedRange
.Value = .Value
varCol = Application.Match("X", .Rows(1), 0)
Do While IsNumeric(varCol)
.Columns(varCol).Delete
varCol = Application.Match("X", .Rows(1), 0)
Loop
.Rows(1).Clear
End With
End With
.ScreenUpdating = True
.EnableEvents = True
.Calculation = iCalc
End With
End Sub
Grüße
Karel