Hi,
I have a following macro in a worksbook. whenever i close this workbook and another work book is open.. excel crashes. Only time excel does not crash is if i open another excel session and if there i open macro enabled work book. Please let me know why this is happening. Thanks in advance for your help.
Thanks
Sushil
Sub Update()
With ActiveSheet
.Protect Password:="PASSWORD", UserInterfaceOnly:=True
For Each pt In .PivotTables
pt.RefreshTable
Next pt
End With
End Sub
Sub Insert_Row()
ActiveSheet.Unprotect Password:="PASSWORD"
If Selection.Rows.Count > 1 Then Exit Sub
With Selection
.EntireRow.Copy
.Offset(1).EntireRow.Insert
Application.CutCopyMode = False
On Error Resume Next
.Offset(1).EntireRow.SpecialCells(xlCellTypeConstants).ClearContents
On Error GoTo 0
ActiveSheet.Protect Password:="PASSWORD"
End With
End Sub
Sub delete_row()
ActiveSheet.Unprotect Password:="PASSWORD"
ActiveCell.EntireRow.Delete
ActiveSheet.Protect Password:="PASSWORD"
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
End Sub
I have a following macro in a worksbook. whenever i close this workbook and another work book is open.. excel crashes. Only time excel does not crash is if i open another excel session and if there i open macro enabled work book. Please let me know why this is happening. Thanks in advance for your help.
Thanks
Sushil
Sub Update()
With ActiveSheet
.Protect Password:="PASSWORD", UserInterfaceOnly:=True
For Each pt In .PivotTables
pt.RefreshTable
Next pt
End With
End Sub
Sub Insert_Row()
ActiveSheet.Unprotect Password:="PASSWORD"
If Selection.Rows.Count > 1 Then Exit Sub
With Selection
.EntireRow.Copy
.Offset(1).EntireRow.Insert
Application.CutCopyMode = False
On Error Resume Next
.Offset(1).EntireRow.SpecialCells(xlCellTypeConstants).ClearContents
On Error GoTo 0
ActiveSheet.Protect Password:="PASSWORD"
End With
End Sub
Sub delete_row()
ActiveSheet.Unprotect Password:="PASSWORD"
ActiveCell.EntireRow.Delete
ActiveSheet.Protect Password:="PASSWORD"
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
End Sub