View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default VBA : Excel Range Selection Problem

if the last column has an empty cell, then you would have this problem.
does your last column have an empty cell within the last column in the data
you want to select?


Perhaps

Dim rng as Range
set rng = cells(rows.count,intLastColumn).End(xlup)
Range(Cells(7, 6), rng).Select
Selection.NumberFormat = "0"

or if Column 1 would be the best column to find the last filled row

Dim rng as Range
set rng = cells(rows.count,1).End(xlup)
Range(Cells(7, 6), Cells(rng.row, intLastColumn)).Select
Selection.NumberFormat = "0"

UsedRange is not always reliable for what you want to do, especially if you
will be deleting data at the bottom of your populated area.

--
Regards,
Tom Ogilvy

"Learner" wrote in message
oups.com...
Thanks for the prompt repsonse.
I got it working with Activesheet.UsedRange
But it is selecting only ALL the columns...I am looking for something
that would select all the ROWS