Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default UsedRange problem

Hi all

I used UsedRange from the ActiveSheet to loop through each cell and process
data.

Sometimes I have blank rows inside my range. This works fine with UsedRange.
Sometimes the first few rows are blanks and they must be processed as well.
However, UsedRange does not pick them up.

I appreciate that this is the intended functionality of the UsedRange. But
is it possible for UsedRange to be discriminatory and exclude only the
trailing blank rows?

I cannot used a fixed range as the number of columns and cells in my sheet
can be different for different files.
Any ideas?

Many thanks
Andy


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default UsedRange problem

Andy

Try something like this

Range("B2).select 'place the activecell in the data area
ActiveCell.CurrentRegion.Select

This selects empty cells and headers

Regards
Peter

-----Original Message-----
Hi all

I used UsedRange from the ActiveSheet to loop through

each cell and process
data.

Sometimes I have blank rows inside my range. This works

fine with UsedRange.
Sometimes the first few rows are blanks and they must be

processed as well.
However, UsedRange does not pick them up.

I appreciate that this is the intended functionality of

the UsedRange. But
is it possible for UsedRange to be discriminatory and

exclude only the
trailing blank rows?

I cannot used a fixed range as the number of columns and

cells in my sheet
can be different for different files.
Any ideas?

Many thanks
Andy


.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default UsedRange problem

Many thanks Jim and Peter. I will test them both out.


Range("A1", Cells.SpecialCells(xlCellTypeLastCell))

Adjust A1 if you want to start from another cell.

--
Jim Rech
Excel MVP




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why is worksheet.usedrange empty? Sara Excel Worksheet Functions 2 August 24th 07 03:38 PM
Excel 2007 BUG UsedRange/LastCell differences with Excel2003. keepITcool Excel Discussion (Misc queries) 2 May 31st 06 06:18 PM
Real Value of .UsedRange.Rows.Count dazman Excel Worksheet Functions 2 August 25th 05 03:24 PM
Find Usedrange question Stuart[_5_] Excel Programming 2 August 31st 03 06:39 PM
Usedrange Terry VanDuzee Excel Programming 6 August 10th 03 05:57 PM


All times are GMT +1. The time now is 02:41 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"