Hi all,

This code does every thing i want it to, even though its not written well.
The problem is if i use the line:

'====> ActiveSheet.Protect 'Password:="12345"

at the end, then the code hangs up, and i don't understand why as the code should be
done running when the sheet is re-protected.

If i don't use the line to reprotect the sheet then the code does what its supose to without eror.

Error is --> "Unable to set the lineStyle Property of the Border Class"
and its on the first ".LineStyle = xlDash" line.

Private Sub Worksheet_Change(ByVal Target As Range)
    ActiveSheet.Unprotect 'Password:="12345"
    Dim LRow As Long
    '''''Auto number in Column A
    If Not Application.Intersect(Range("b:b"), Target) Is Nothing Then
        Target.Offset(0, -1).Value = "=(Row() - 4)"
    End If
    '''''Autofill the formulas
    If Target.Column = 2 Then
        LRow = Cells(Rows.Count, 2).End(xlUp).Row
        Range("BG5").AutoFill Destination:=Range("BG5:BG" & LRow)
        Range("BH5").AutoFill Destination:=Range("BH5:BH" & LRow)
        Range("BI5").AutoFill Destination:=Range("BI5:BI" & LRow)
        Range("BJ5").AutoFill Destination:=Range("BJ5:BJ" & LRow)
    End If
    ''''''Borders down to last used cell in Column B
    LRow = Cells(Rows.Count, "b").End(xlUp).Row
    With Range("A" & LRow, "BJ" & LRow)
        
        With .Borders(xlEdgeRight)
            .LineStyle = xlDash
            .Weight = xlThin
            .ColorIndex = xlAutomatic
        End With
        With .Borders(xlInsideVertical)
            .LineStyle = xlDash
            .Weight = xlThin
            .ColorIndex = xlAutomatic
        End With
        With .Borders(xlEdgeLeft)
            .LineStyle = xlDash
            .Weight = xlThin
            .ColorIndex = xlAutomatic
        End With
    End With
    '====> ActiveSheet.Protect 'Password:="12345"
End Sub