Hi i am trying to add a macro to save and close excel after a period of 15min of inactivity as a number of people use the excel spreadsheet and leave open which then locks the spreadsheet.
I already have code in Module 1:
Sub InsertAndLockRow()
Dim ws As Worksheet
Dim newRow As Range
Dim oldRow As Range
ActiveSheet.Unprotect
Set ws = ActiveSheet
ws.Rows(10).Insert Shift:=xlDown
Set newRow = ws.Rows(10)
Set oldRow = ws.Rows(11)
oldRow.Locked = True
oldRow.FormulaHidden = True
newRow.Locked = False
Range("A10:E10").Font.Bold = False
With Range("A10:E10").Borders
.LineStyle = xlContinuous
.Weight = xlThin
End With
With Range("A10:E10").Interior
.Pattern = xlNone
End With
With Range("C10:E10")
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.ReadingOrder = xlContext
End With
Range("C10:E10").Merge
Rows("10:10").RowHeight = 105
Range("A10").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFormattingCells:=True
End Sub
I already have code in Module 1:
Sub InsertAndLockRow()
Dim ws As Worksheet
Dim newRow As Range
Dim oldRow As Range
ActiveSheet.Unprotect
Set ws = ActiveSheet
ws.Rows(10).Insert Shift:=xlDown
Set newRow = ws.Rows(10)
Set oldRow = ws.Rows(11)
oldRow.Locked = True
oldRow.FormulaHidden = True
newRow.Locked = False
Range("A10:E10").Font.Bold = False
With Range("A10:E10").Borders
.LineStyle = xlContinuous
.Weight = xlThin
End With
With Range("A10:E10").Interior
.Pattern = xlNone
End With
With Range("C10:E10")
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.ReadingOrder = xlContext
End With
Range("C10:E10").Merge
Rows("10:10").RowHeight = 105
Range("A10").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFormattingCells:=True
End Sub