View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dana DeLouis[_3_] Dana DeLouis[_3_] is offline
external usenet poster
 
Posts: 690
Default Find Lowest Column Among Several

Just another idea. I asssume you are trying to shrink the range "Accounts"
to fit the last entry. Hopefully you can modify it to fit your needs.

Sub Demo()
Dim LastRow As Long
Const s As String = "Accounts"

With Range(s)
LastRow = .Find("*", .Cells(1), xlValues, xlWhole, xlByRows,
xlPrevious).Row
ActiveWorkbook.Names.Add s, Intersect(Range(s),
Rows(1).Resize(LastRow))

'Test...
[Accounts].Select
End With
End Sub


--
Dana DeLouis
"MDW" wrote in message
...
Say I've got the line

Set objProduction = objCurrent.Worksheets("ACCOUNTS").Range("A4:F600")

in code. On the worksheet "ACCOUNTS", the last entry by the user might be
in
row 23. However, it may be in column A, or column C, or column E.

Is there any way for Excel to detect that, among those 8 columns, the
lowest
used row is 23, and then resize the range?
--
Hmm...they have the Internet on COMPUTERS now!