Offset Problem

poorwallace

Active Member
Joined
Mar 8, 2005
Messages
365
Hi...here's what's going...

I'm working my way around to naming a range that I can work with...here's what I've got

Code:
Dim lastrow5 As Long
lastrow5 = Cells(Rows.Count, 5).End(xlUp).End(xlUp).Row

Dim lastrow52 As Long
lastrow52 = Cells(lastrow5, 5).Offset(-2, 0)
Cells(lastrow52, 5).Select

When I step through the code, lastrow = 20, which is correct...so I figure lastrow52 will = Cell(18,5). Well...that's not what's happening. Lastrow52 is returning Cell(38701,5). I'm completely at a loss....any ideas?

Thanks
 

Some videos you may like

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

Watch MrExcel Video

Forum statistics

Threads
1,118,522
Messages
5,572,637
Members
412,476
Latest member
luihp329
Top