Laufzeitfehler 1004
27.09.2006 10:32:36
Herbert
Ich habe ein Makro zum Formatieren von meinem Arbeitsblatt (ist zwar nicht sehr kurz gefasst aber hat funktioniert)
Seit kurzem habe ich die Arbeitsmappe für andere Benutzer freigegeben und bekomme immer "Laufzeitfehler 1004" , Die Merge Cells - Eigenschaft des Range - Objektes kann nicht festgelegt werden.
Bitte um Hilfe , im Anschluß mein Code (mit Recorder) mfG Herbert
----------------------------------------------------------------
Sub Format()
' Format Makro
ActiveWindow.SmallScroll Down:=-3
Range("B2:AK46").Select
Selection.Font.Bold = True
ActiveWindow.LargeScroll ToRight:=1
Columns("AL:AV").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
Selection.Interior.ColorIndex = xlNone
Selection.ClearContents
Rows("47:87").Select
Selection.ClearContents
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
Selection.Interior.ColorIndex = xlNone
ActiveWindow.LargeScroll Down:=-1
ActiveWindow.LargeScroll ToRight:=-1
Range("B2:G4").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = 5
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = 5
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = 5
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = 5
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlHairline
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlHairline
.ColorIndex = xlAutomatic
End With
Selection.Copy
Range("B2:AK46").Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
ActiveWindow.SmallScroll Down:=-6
Range("A2:A46").Select
Application.CutCopyMode = False
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 5
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 5
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 5
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = 5
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 5
End With
With Selection.Interior
.ColorIndex = 19
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Range("N1:AK1").Select
Range("AF1").Activate
Selection.Interior.ColorIndex = 38
ActiveWindow.LargeScroll ToRight:=-1
Range("H1:M1").Select
Selection.Interior.ColorIndex = 35
Range("B1:G1").Select
Selection.Interior.ColorIndex = 34
Range("B1:AK1").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 5
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 5
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = 5
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 5
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 5
End With
ActiveWindow.LargeScroll ToRight:=-1
Range("A1").Select
ActiveWindow.SmallScroll Down:=-9
Range("H2:M46").Select
With Selection.Interior
.ColorIndex = 35
.Pattern = xlSolid
End With
ActiveWindow.SmallScroll Down:=-18
ActiveWindow.SmallScroll Down:=-21
Range("M4,M7,M10,M13,M16,M19,M22,M25,M28,M31,M34,M37,M40,M43").Select
Range("M43").Activate
ActiveWindow.SmallScroll Down:=6
Range("M4,M7,M10,M13,M16,M19,M22,M25,M28,M31,M34,M37,M40,M43,M46").Select
Range("M46").Activate
Selection.Font.ColorIndex = 3
ActiveWindow.SmallScroll Top:
Range("B2").Select
End Sub