Hi guys , I have the folowing code in a workbook
When I open this workbook manually, ActiveCell.SpecialCells(xlLastCell).address gives me a location of $AG$10849
When I open it using VBA code and then close it again the beforeClose event fires but the ActiveCell.SpecialCells(xlLastCell).address gives me $A$1 and the validation that occurs in the remainder of the procedure fails.
I'm going to change it to use UsedRange instead but wondered why I get different behaviour from the two opening methods
Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim cell As Range
Dim DupAssetRows As String
Dim NonNumvericValues As String
Stop
Sheets("Copied from scheme files").Select
Range("A1").Select
ActiveCell.SpecialCells(xlLastCell).Select
.....
End Sub
When I open this workbook manually, ActiveCell.SpecialCells(xlLastCell).address gives me a location of $AG$10849
When I open it using VBA code and then close it again the beforeClose event fires but the ActiveCell.SpecialCells(xlLastCell).address gives me $A$1 and the validation that occurs in the remainder of the procedure fails.
I'm going to change it to use UsedRange instead but wondered why I get different behaviour from the two opening methods