View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default early beginner, simple question about End(xlUp)

Still about that entrie below, could this object be a mulitple column
range? Or the fact that "A" is mentionned in A65536 tells Vba to look
in A column only?

Set BottomCel = Range("A65536").End(xlUp)


It looks in Col-A only. It's the same as manually - select A65536, press
End, up-arrow.

What about this way to do it?

iEndRow = Sheets(4).Range("B2").End(xlDown).Row


Again, same as manually - select B2, press End, down-arrow.
With your '.Row' the code returns the row number of the range returned by
'.End(xlDown)'

Sheets(4).Range("D4:D" & iEndRow)


Apart from (presumably) needing to assign the returned range to a range
variable, you might want to cater for the the possibility that iEndRow = 3
(if B3 is not empty and B3 is empty) or iEndRow = 65536 if there is no data
below B2.

===========end of simple answer ===========

Regards,
Peter T

"wbrowse" wrote in message
ups.com...
Hi,

Does the following tells Excel or Vba to assign the lastest bottom
cell in the range A:A to BottomCell. In other words, is it a single
cell being taken in consideration or is it a range? Because for me,
from A65526 to xlUp, wherever is xlup it is a range.

Still about that entrie below, could this object be a mulitple column
range? Or the fact that "A" is mentionned in A65536 tells Vba to look
in A column only?

Set BottomCel = Range("A65536").End(xlUp)

What about this way to do it?

iEndRow = Sheets(4).Range("B2").End(xlDown).Row
Sheets(4).Range("D4:D" & iEndRow)

===========end of simple question===========

============thanks for your help============