AW: Willie
22.12.2003 10:57:21
Chris
Hi Willie,
kommt ne Fehlermeldung! "Laufzeitfehler 1004 - Anwendungs-oder objektorientierter Fehler"
Hier ist mein komplettes Makro! Meine Meinung nach, hängt es aber an dem "Merge"
LG Chris
Dim b As Boolean
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Worksheets("Dichtheit Umgehungs-Ventil").Activate
Dim k, counter As Integer
If Target.Interior.ColorIndex = xlColorIndexNone Then GoTo ende
ActiveSheet.Unprotect "6666"
If Target.Column = 1 And Target.Row > 47 Then
If Not IsEmpty(Target.Value) Then
If b = False Then
b = True
Rows(Target.Row + 1).Insert
' Range(Cells(Target.Row, 2), Cells(Target.Row, 3)).Select
' Selection.Merge
' Range(Cells(Target.Row, 2), Cells(Target.Row, 3)).Merge
End If
counter = counter + 1
ActiveCell.Activate
ActiveSheet.Unprotect "6666"
Range(ActiveCell, Cells(Target.Row, Target.Column + 5)).Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
ActiveCell.Select
ElseIf Target.Row > 48 Then
b = True
Rows(Target.Row).Delete
Application.ScreenUpdating = True
End If
End If
ende:
ende1:
ActiveSheet.Protect "6666", DrawingObjects:=False
b = False
End Sub