ich mal wieder. Ich habe ein Makro aufgezeichnet. Wenn ich es jetzt so ausführe geht es. Wenn ich es aber mit einem Button verbinde, geht es nicht bzw. Excel meckert rum. Woran kann das liegen?
Gruß
Gordon
Sub Import()
' Import Makro
Sheets("HD A").Select
Range("A12:C21").Select
Selection.Copy
Sheets("Spieplan Doppel").Select
Range("D3:D12").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.UnMerge
Sheets("HD A").Select
ActiveWindow.SmallScroll Down:=20
Range("A34:C43").Select
Selection.Copy
Sheets("Spieplan Doppel").Select
Range("D13:D22").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.UnMerge
Sheets("HD A").Select
Range("A55:C64").Select
Selection.Copy
Sheets("Spieplan Doppel").Select
Range("D23:D32").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.UnMerge
Sheets("HD A").Select
ActiveWindow.SmallScroll Down:=20
Range("A77:C86").Select
Selection.Copy
Sheets("Spieplan Doppel").Select
Range("D33:D42").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.UnMerge
Sheets("HD A").Select
ActiveWindow.SmallScroll Down:=20
Range("A100:C109").Select
Selection.Copy
Sheets("Spieplan Doppel").Select
Range("D43:D52").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.UnMerge
Sheets("HD B").Select
Range("A12:C21").Select
Selection.Copy
Sheets("Spieplan Doppel").Select
Range("D53:D62").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.UnMerge
Sheets("HD B").Select
ActiveWindow.SmallScroll Down:=20
Range("A34:C43").Select
Selection.Copy
Sheets("Spieplan Doppel").Select
Range("D63:D72").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.UnMerge
Sheets("HD B").Select
Range("A55:C64").Select
Selection.Copy
Sheets("Spieplan Doppel").Select
Range("D73:D82").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.UnMerge
Sheets("HD B").Select
ActiveWindow.SmallScroll Down:=20
Range("A77:C86").Select
Selection.Copy
Sheets("Spieplan Doppel").Select
Range("D83:D92").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.UnMerge
Sheets("HD B").Select
ActiveWindow.SmallScroll Down:=20
Range("A100:C109").Select
Selection.Copy
Sheets("Spieplan Doppel").Select
Range("D93:D102").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.UnMerge
Sheets("HD C").Select
Range("A12:C21").Select
Selection.Copy
Sheets("Spieplan Doppel").Select
Range("D103:D112").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.UnMerge
Sheets("HD C").Select
ActiveWindow.SmallScroll Down:=20
Range("A34:C43").Select
Selection.Copy
Sheets("Spieplan Doppel").Select
Range("D113:D122").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.UnMerge
Sheets("HD C").Select
Range("A55:C64").Select
Selection.Copy
Sheets("Spieplan Doppel").Select
Range("D123:D132").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.UnMerge
Sheets("HD C").Select
ActiveWindow.SmallScroll Down:=20
Range("A77:C86").Select
Selection.Copy
Sheets("Spieplan Doppel").Select
Range("D133:D142").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.UnMerge
Sheets("DD A").Select
Range("A12:C21").Select
Selection.Copy
Sheets("Spieplan Doppel").Select
Range("D143:D152").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.UnMerge
Sheets("DD A").Select
ActiveWindow.SmallScroll Down:=20
Range("A34:C43").Select
Selection.Copy
Sheets("Spieplan Doppel").Select
Range("D153:D162").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.UnMerge
Sheets("DD A").Select
Range("A55:C64").Select
Selection.Copy
Sheets("Spieplan Doppel").Select
Range("D163:D172").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.UnMerge
Sheets("DD A").Select
ActiveWindow.SmallScroll Down:=20
Range("A77:C86").Select
Selection.Copy
Sheets("Spieplan Doppel").Select
Range("D173:D182").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.UnMerge
Sheets("DD B").Select
Range("A12:C21").Select
Selection.Copy
Sheets("Spieplan Doppel").Select
Range("D183:D192").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.UnMerge
Sheets("DD B").Select
ActiveWindow.SmallScroll Down:=20
Range("A34:C43").Select
Selection.Copy
Sheets("Spieplan Doppel").Select
Range("D193:D202").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.UnMerge
Sheets("DD B").Select
Range("A55:C64").Select
Selection.Copy
Sheets("Spieplan Doppel").Select
Range("D203:D212").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.UnMerge
Sheets("DD B").Select
ActiveWindow.SmallScroll Down:=20
Range("A77:C86").Select
Selection.Copy
Sheets("Spieplan Doppel").Select
Range("D213:D222").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.UnMerge
Sheets("DD C").Select
Range("A12:C21").Select
Selection.Copy
Sheets("Spieplan Doppel").Select
Range("D223:D232").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.UnMerge
Sheets("DD C").Select
ActiveWindow.SmallScroll Down:=20
Range("A34:C43").Select
Selection.Copy
Sheets("Spieplan Doppel").Select
Range("D233:D242").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.UnMerge
Sheets("DD C").Select
Range("A55:C64").Select
Selection.Copy
Sheets("Spieplan Doppel").Select
Range("D243:D252").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.UnMerge
Sheets("DD C").Select
ActiveWindow.SmallScroll Down:=20
Range("A77:C86").Select
Selection.Copy
Sheets("Spieplan Doppel").Select
Range("D253:D262").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.UnMerge
Columns("D:D").Select
Range("D2").Activate
Selection.FormatConditions.Delete
Range("K3:L54").Select
Selection.Copy
Range("B3:C54").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
ActiveWindow.SmallScroll Down:=48
Range("B55:C106").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
ActiveWindow.SmallScroll Down:=63
Range("B107:C158").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
ActiveWindow.SmallScroll Down:=66
Range("B159:C210").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
ActiveWindow.SmallScroll Down:=66
Range("B211:C262").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
ActiveWindow.SmallScroll Down:=-216
Range("A1:F1").Select
Range("B3:H262").Select
Selection.Sort Key1:=Range("H3"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Range("A1:F1").Select
End Sub
Sub test()
Bereiche_kopieren "HD A", 3
Bereiche_kopieren "HD B", 53
Bereiche_kopieren "HD C", 103
Bereiche_kopieren "DD A", 143
Bereiche_kopieren "DD B", 183
Bereiche_kopieren "DD C", 223
With Sheets("Spieplan Doppel")
.Columns("D:D").FormatConditions.Delete
.Range("B3:C54").Value = .Range("K3:L54").Value
.Range("B55:C106").Value = .Range("K3:L54").Value
.Range("B107:C158").Value = .Range("K3:L54").Value
.Range("B159:C210").Value = .Range("K3:L54").Value
.Range("B211:C262").Value = .Range("K3:L54").Value
.Range("B3:H262").Sort Key1:=.Range("H3"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
.Range("A1:F1").Select
End With
End Sub
Sub Bereiche_kopieren(strSheet As String, ersteZeile As Integer)
Dim objZiel As Object
Set objZiel = ThisWorkbook.Sheets("Spieplan Doppel")
With Sheets(strSheet)
.Range("A12:C21").Copy Destination:=objZiel.Range("D" & ersteZeile)
.Range("A34:C43").Copy Destination:=objZiel.Range("D" & ersteZeile + 10)
.Range("A55:C64").Copy Destination:=objZiel.Range("D" & ersteZeile + 20)
.Range("A77:C86").Copy Destination:=objZiel.Range("D" & ersteZeile + 30)
If strSheet = "HD A" Or strSheet = "HD B" Then
.Range("A100:C109").Copy Destination:=objZiel.Range("D" & ersteZeile + 40)
End If
End With
End Sub