View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default count # of elemnts in a column

set rng = Range(Cells(1,1),Cells(rows.count,1).End(xlup))

now rng has a reference to the used range of Column A (ignoring interior
cells which may be blank).

If i wanted to work with the same range in column G for instance

set rngG = rng.offset(0,7)
set rngB = rng.offset(0,1)

or

just to get the last row

lastrow = Cells(rows.count,1).End(xlup)
Range("B1:B" & lastRow)
or
Range("B1").Resize(lastrow,1) '< only good if starting from B1

--
Regards,
Tom Ogilvy




"ferrdav" wrote in message
...
thank's tom for your help.

but my problem is a bit different: once ai get icnt (h in my
formulation), how can i use in Range object?

for example: if i write range("B1:Bh") this does not work.

what i would like is to set the range in order to let him fit the
number of rows are in my worksheet (maybe there is anathor method).



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/