View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Ayo Ayo is offline
external usenet poster
 
Posts: 489
Default How do I determine the last cell in a Column

Thanks Dave.

"Dave Peterson" wrote:

dim c as range
Dim myRng as range
with wsht
set myrng = .range(.cells(4,14), .cells(4,lastcol))
end with

for each c in myrng.cells
.....

Ayo wrote:

Thanks Sheeloo. One more question, how do I use it in a for statement that
is looping through cells D14: T14 i.e.,

For Each c In Wsht.Range((4, 14), (4, lastColumn)).Cells
If c.Value = Range("B4") Then
getMSaddress = c.Address(ColumnAbsolute:=False)
Exit Function
End If
Next c

"Sheeloo" wrote:

Try...
Range("IV1").End(xlToLeft).Column

I prefer to use...

With ActiveSheet
lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
lastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
End With

"Ayo" wrote:

I know how to get the last cell in a column:

range("A65536").End(xlUp).address for the row number
range("A65536").End(xlUp).row for the row number

but I am not sure how to translate this to doing the same for the row.
Any help with be appreciated. Thanks.



--

Dave Peterson