J
Juan Sanchez
MDW
Try:
'=========================================================
Sub FindLastUsdRow()
' This is for your range A:F, Follow the logic for A:H
Dim nLastUsdRow As Long
Dim cnt As Integer
Dim objLookIn
nLastUsdRow = 0
For cnt = 1 To 6
If Cells(2 ^ 16, cnt).End(xlUp).Row > nLastUsdRow Then
nLastUsdRow = Cells(2 ^ 16, cnt + 1).End(xlUp).Row
End If
Next cnt
Set objLookIn = objCurrentSheet.Range(Cells(4, 1), Cells
(nLastUsdRow, 6))
' objCurrentSheet is not defined in this sub, I expect you
defined it in yours.
End Sub
'=========================================================
Hope this helps...
cheers
Juan
lot of time. I'd like to redefine my range so that I'm
searching the smallest possible area.
or it might be column G, etc? Here's what I want to
define:
possibly spaces. I'm worried that they might throw off the
calculation. For instance, say here's a range
Try:
'=========================================================
Sub FindLastUsdRow()
' This is for your range A:F, Follow the logic for A:H
Dim nLastUsdRow As Long
Dim cnt As Integer
Dim objLookIn
nLastUsdRow = 0
For cnt = 1 To 6
If Cells(2 ^ 16, cnt).End(xlUp).Row > nLastUsdRow Then
nLastUsdRow = Cells(2 ^ 16, cnt + 1).End(xlUp).Row
End If
Next cnt
Set objLookIn = objCurrentSheet.Range(Cells(4, 1), Cells
(nLastUsdRow, 6))
' objCurrentSheet is not defined in this sub, I expect you
defined it in yours.
End Sub
'=========================================================
Hope this helps...
cheers
Juan
you can imagine, looking through all those cells takes a-----Original Message-----
Say I've got a range:
Set objLookIn = objCurrentSheet.Range("A:F")
or
Set objLookIn = objCurrentSheet.Range("A:H")
I'm doing a search through those columns using a loop. As
lot of time. I'd like to redefine my range so that I'm
searching the smallest possible area.
among all the columns in a range? It might be column A,Is there a way I can find what the lowest used cell is
or it might be column G, etc? Here's what I want to
define:
some of the cells in the form of 0-length strings orUPPER LEFT CELL - will ALWAYS be A4
FARTHEST COLUMN RIGHT - either F or H
LOWEST ROW DOWN - the lowest utilized row from among A-F (or A-H, depending)
As an added complication, there seem to be "values" in
possibly spaces. I'm worried that they might throw off the
calculation. For instance, say here's a range