MattieIJClark
New Member
In need of some assistance with the attached spreadsheet and VBA code.
I get a debug error, I've attached a copy of the updated spreadsheet and the password is p1645102.
Any help will be greatly appreciated.
Thanks
Code:
Sub test()
Dim oldrow As Long
' Unprotect sheet
ActiveSheet.Unprotect Password:="p1645102"
' insert row below
oldrow = ActiveCell.Row
Rows(oldrow + 1).Insert
' copy formula cells
With Sheets("Deadlines")
.Range("T" & oldrow).Copy .Range("T" & oldrow + 1)
.Range("V" & oldrow).Copy .Range("V" & oldrow + 1)
.Range("W" & oldrow).Copy .Range("W" & oldrow + 1)
.Range("Z" & oldrow).Copy .Range("Z" & oldrow + 1)
End With
' Protect sheet
ActiveSheet.Protect Password:="p1645102", _
DrawingObjects:=True, Contents:=True, _
Scenarios:=True, AllowFiltering:=True
End Sub
However, my autofit VBA no long works once the above has been used:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Application.ScreenUpdating = False
For Each Value In Target.Columns
Worksheets(Sh.Name).Columns(Value.Column).AutoFit
Next Value
Application.ScreenUpdating = True
End Sub
I get a debug error, I've attached a copy of the updated spreadsheet and the password is p1645102.
Any help will be greatly appreciated.
Thanks
Attachments
Last edited by a moderator: