Option
Explicit
Public
Sub
Neue_Ordnung()
Dim
loSpalte
As
Long
Dim
raSuchbereich
As
Range, raSuchbegriff
As
Range
Dim
raZelleSpalte
As
Range, raZelleZeile
As
Range
Application.ScreenUpdating =
False
With
Worksheets(
"Tabelle1"
)
loSpalte = .Cells(1, 1).
End
(xlToRight).Column
Set
raSuchbereich = .Range(.Cells(1, 1), .Cells(1, loSpalte))
Set
raSuchbegriff = .Range(
"G1:G"
& .Cells(.Rows.Count, 7).
End
(xlUp).Row)
For
Each
raZelleZeile
In
raSuchbegriff
For
Each
raZelleSpalte
In
raSuchbereich
If
raZelleZeile.Value = raZelleSpalte.Value
Then
.Columns(raZelleSpalte.Column).Copy Worksheets(
"Tabelle2"
).Columns(raZelleZeile.Row)
Exit
For
End
If
Next
raZelleSpalte
Next
raZelleZeile
End
With
Set
raSuchbereich =
Nothing
:
Set
raSuchbegriff =
Nothing
Application.ScreenUpdating =
True
End
Sub