Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Way to make range the whole spreadsheet

I'm working on VS 2005 with Excel 2003. I need to set the range for the
entire sheet, but I do not know the number of rows in use for the
spreadsheet. I tried this:
oRng = oSheet.Range("A1").EntireColumn
TotRows = oRng.Count
TotRows ended up 65,5xx. Not useful. I really don't need to set a range, I
just need to know how many rows are being used. I need to programmatically
scan down the first column to see if a particular string is there and if it
is go process the next 5 rows or so. To do this, I need the total number of
rows in use. Shoulod I just give up and search all 65K rows?

Does anyone know how to do this?
--
Bettie
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Way to make range the whole spreadsheet



UsedRows = oSheet.UsedRange.Rows.Count

will usually do it, although from time to time Excel forgets what the
used range really is. You force it with

oSheet.UsedRange
UsedRows = oSheet.UsedRange.Rows.Count

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



On Tue, 15 Sep 2009 15:15:01 -0700, BGCSOCAL
wrote:

I'm working on VS 2005 with Excel 2003. I need to set the range for the
entire sheet, but I do not know the number of rows in use for the
spreadsheet. I tried this:
oRng = oSheet.Range("A1").EntireColumn
TotRows = oRng.Count
TotRows ended up 65,5xx. Not useful. I really don't need to set a range, I
just need to know how many rows are being used. I need to programmatically
scan down the first column to see if a particular string is there and if it
is go process the next 5 rows or so. To do this, I need the total number of
rows in use. Shoulod I just give up and search all 65K rows?

Does anyone know how to do this?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Way to make range the whole spreadsheet

Mega Thanks! Can you recommend a good article about this Excel programming
Excel 2003 and 2007? The one I have may be from VS2003 or earlier!
--
Bettie


"Chip Pearson" wrote:



UsedRows = oSheet.UsedRange.Rows.Count

will usually do it, although from time to time Excel forgets what the
used range really is. You force it with

oSheet.UsedRange
UsedRows = oSheet.UsedRange.Rows.Count

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



On Tue, 15 Sep 2009 15:15:01 -0700, BGCSOCAL
wrote:

I'm working on VS 2005 with Excel 2003. I need to set the range for the
entire sheet, but I do not know the number of rows in use for the
spreadsheet. I tried this:
oRng = oSheet.Range("A1").EntireColumn
TotRows = oRng.Count
TotRows ended up 65,5xx. Not useful. I really don't need to set a range, I
just need to know how many rows are being used. I need to programmatically
scan down the first column to see if a particular string is there and if it
is go process the next 5 rows or so. To do this, I need the total number of
rows in use. Shoulod I just give up and search all 65K rows?

Does anyone know how to do this?


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Way to make range the whole spreadsheet

Take a look here and see if it helps:

http://www.google.com/search?sourcei...tutorial+excel



"BGCSOCAL" wrote in message
...
Mega Thanks! Can you recommend a good article about this Excel programming
Excel 2003 and 2007? The one I have may be from VS2003 or earlier!
--
Bettie


"Chip Pearson" wrote:



UsedRows = oSheet.UsedRange.Rows.Count

will usually do it, although from time to time Excel forgets what the
used range really is. You force it with

oSheet.UsedRange
UsedRows = oSheet.UsedRange.Rows.Count

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



On Tue, 15 Sep 2009 15:15:01 -0700, BGCSOCAL
wrote:

I'm working on VS 2005 with Excel 2003. I need to set the range for the
entire sheet, but I do not know the number of rows in use for the
spreadsheet. I tried this:
oRng = oSheet.Range("A1").EntireColumn
TotRows = oRng.Count
TotRows ended up 65,5xx. Not useful. I really don't need to set a range,
I
just need to know how many rows are being used. I need to
programmatically
scan down the first column to see if a particular string is there and if
it
is go process the next 5 rows or so. To do this, I need the total number
of
rows in use. Shoulod I just give up and search all 65K rows?

Does anyone know how to do this?




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
how do I make a list from a spreadsheet? wmphimu Excel Discussion (Misc queries) 2 June 27th 08 01:16 AM
How can I make the top row of my spreadsheet non-scrollable? Stumped Excel Discussion (Misc queries) 2 February 6th 06 11:56 PM
I cant make entries in my spreadsheet expense report Excel Discussion (Misc queries) 1 October 8th 05 06:03 PM
make a spreadsheet leslieguy Excel Discussion (Misc queries) 1 June 16th 05 08:04 PM
make my spreadsheet at 10% to all cells jenshakay1972 Excel Worksheet Functions 1 March 22nd 05 10:27 PM


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

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

About Us

"It's about Microsoft Excel"