Helo!
I created a macro to insert and delete lines in a worksheet. The code I used for insert is as follows:
Set ws = Application.ActiveWorkbook.ActiveSheet
Worksheets("Matrika").Unprotect Password:="kas"
Application.ScreenUpdating = False
i = 10
Do While ws.Cells(i, 1) <> "xxx"
i = i + 1
Loop
Rows("" & i - 1 & ":" & i - 1 & "").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
ws.Rows(i - 2).Copy ws.Rows(i - 1)
For j = 1 To 64
ws.Cells(i - 1, j) = Clear
Next
Application.ScreenUpdating = True
Worksheets("Matrika").Protect Password:="kas"
This worksheet uses 64 columns and they are all filled with numbers. Numbers start at line 10. Bottom line sums each column. Macro counts how many rows there are and inserts a line before the line with sums, copies the line before the inserted one into the new one and clears cells. When I start putting numbers into the new line, bottom line sums update automaticaly.
Now, my problem starts when I try to return protection to worksheet, whether I do it manually or with vba code, this action removes all sum formulas from my bottom line.
If anyone knows why this might be happening, please post an answer
Thanks.
Bookmarks