View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Find Lowest Column Among Several

Dim maxrow as Long, lastrow as Long, i as long
maxrow = 1
with ObjCurrent.Worksheets("Accounts")
for i = 1 to 6
lastRow = .Cells(rows.count,i).End(xlup)
if lastrow maxrow then maxrow = lastrow
Next
Set objProduction = .Range("A4").Resize(maxrow - 3, 6)
End With

--
Regards,
Tom Ogilvy

"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!