AW: Mein Fehler
12.06.2017 16:56:06
Christian
Vielen Dank für deinen Einsatz aber das hat leider nichts verändert.
So sieht es im Moment bei mir aus
Sub Commandbutton_Reset_1_Click()
Dim ws As Worksheet, ws2 As Worksheet
Dim rng As Range
Dim j As Long, i As Long
Dim cRow As Long, cCol As Long
Dim cCol2 As Long
Dim sName As String
Set ws = ThisWorkbook.Sheets("Plandaten")
Set ws2 = ThisWorkbook.Sheets("Realdaten")
With ws
j = 5
Do
sName = .Cells(1, j).Value
cRow = .Cells(.Rows.Count, j).End(xlUp).Row
cCol2 = .Cells(1, .Columns.Count).End(xlToLeft).Column
Set rng = .Range(.Cells(2, j), .Cells(cRow, j))
rng.Copy
With ws2
cCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
For i = 1 To cCol
If .Cells(1, i).Value = sName Then
.Cells(2, i).PasteSpecial Paste:=xlPasteAll
.Cells(2, i).PasteSpecial Paste:=xlPasteFormats
.Cells(2, i).PasteSpecial Paste:=xlPasteFormulas
Exit For
End If
Next i
End With
j = j + 4
Loop Until j > cCol2
End With
End Sub