Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Follow On from "?Last Cell" (thread707-255327)

Status
Not open for further replies.

Loomah

Technical User
Mar 4, 2002
1,911
IE
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 A1:D5 & 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!!
[ponder]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top