Looking at this I stumbled accross some strange XL behaviour which I would love someone to explain to me if at all possible.
Using a range A15 & I12 I applied the following code:
Sub used_Range()
Dim iRow As Integer
Dim iCol As Integer
Dim iAreas As Integer
With ActiveSheet.Range("A1".SpecialCells(xlEnd)
.Select
iRow = .Row 'or use rows.count
iCol = .Column 'or use columns.count
End With
Debug.Print iRow
Debug.Print iCol
Debug.Print Selection.Areas.Count
End Sub
Nicely selects the 2 ranges with A1 the active cell. But when deleting the contents of B3 it gets weird. C1 bcome active cell.
I've tried this by adding then deleting data to cells well outside of I12 and it still only selects those cells containing data. I just don't understand what I've done!!
Using a range A15 & I12 I applied the following code:
Sub used_Range()
Dim iRow As Integer
Dim iCol As Integer
Dim iAreas As Integer
With ActiveSheet.Range("A1".SpecialCells(xlEnd)
.Select
iRow = .Row 'or use rows.count
iCol = .Column 'or use columns.count
End With
Debug.Print iRow
Debug.Print iCol
Debug.Print Selection.Areas.Count
End Sub
Nicely selects the 2 ranges with A1 the active cell. But when deleting the contents of B3 it gets weird. C1 bcome active cell.
I've tried this by adding then deleting data to cells well outside of I12 and it still only selects those cells containing data. I just don't understand what I've done!!