E
EagleOne
2003/2007
Need to have Var "OrigRows" established in a Worksheet_Activate event.
Then, once established, I would like to have "OrigRows" available to a second
Private Sub Worksheet_Change procedure as below.
I understand that I cannot declare a Global or Public variable in an object
I have never used a Propery Get. How can I weave the code below together?
Property Get OrigRows() As Long
OrigRows = Sheets("Trial Balance Current").UsedRange.Rows.Count
End Property
Private Sub Worksheet_Change(ByVal Target As Range)
If Sheets("Trial Balance Current").Rows.Count > OrigRows Then
Dim myRange As Range
ActiveSheet.Unprotect Password:="calldennis"
Set myRange = Intersect(ActiveSheet.UsedRange, Selection)
Selection.Locked = False
Selection.FormulaHidden = False
ActiveSheet.Protect Password:="calldennis", DrawingObjects:=False, Contents:=True, _
Scenarios:=False, AllowFormattingCells:=True, AllowFormattingRows:=True, _
AllowInsertingRows:=True, AllowSorting:=True, AllowFiltering:=True, _
AllowUsingPivotTables:=True
End If
End Sub
TIA EagleOne
Need to have Var "OrigRows" established in a Worksheet_Activate event.
Then, once established, I would like to have "OrigRows" available to a second
Private Sub Worksheet_Change procedure as below.
I understand that I cannot declare a Global or Public variable in an object
I have never used a Propery Get. How can I weave the code below together?
Property Get OrigRows() As Long
OrigRows = Sheets("Trial Balance Current").UsedRange.Rows.Count
End Property
Private Sub Worksheet_Change(ByVal Target As Range)
If Sheets("Trial Balance Current").Rows.Count > OrigRows Then
Dim myRange As Range
ActiveSheet.Unprotect Password:="calldennis"
Set myRange = Intersect(ActiveSheet.UsedRange, Selection)
Selection.Locked = False
Selection.FormulaHidden = False
ActiveSheet.Protect Password:="calldennis", DrawingObjects:=False, Contents:=True, _
Scenarios:=False, AllowFormattingCells:=True, AllowFormattingRows:=True, _
AllowInsertingRows:=True, AllowSorting:=True, AllowFiltering:=True, _
AllowUsingPivotTables:=True
End If
End Sub
TIA EagleOne