Ich habe eine Tabelle1 Eingabe und Tabbelle 3 Ablage
und möchte die Spalten A bis H in die Ablage veschieben wenn in A ein x steht und die Tabelle gespeichert wird.
Ich habe das gleiche aber bei x in Zelle A bis ...
Kann mir jemand das umschreiben?
Danke im Voraus Mario
https://www.herber.de/bbs/user/169910.xlsm
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim lngInputColumn As Long, lngOutputColumn As Long
With Tabelle8
If IsEmpty(.Cells(1, 1).Value) Then
lngOutputColumn = 1
Else
lngOutputColumn = .Cells(1, .Columns.Count).End(xlToLeft).Offset(0, 1).Column
End If
End With
With Tabelle1
If WorksheetFunction.CountBlank(.Rows(1)) .Columns.Count Then
For lngInputColumn = 1 To .Cells(1, .Columns.Count).End(xlToLeft).Column
If Not IsEmpty(.Cells(1, lngInputColumn).Value) Then
Call .Columns(lngInputColumn).Cut(Destination:=Tabelle8.Cells(1, lngOutputColumn))
Call .Columns(lngInputColumn).Delete
lngOutputColumn = lngOutputColumn + 1
lngInputColumn = lngInputColumn - 1
End If
Next
End If
End With
End Sub