Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Need to dynamically choose Ranges of non-empty objects

hello,

This is a basic questions... i have just started using vb....

I want to figure out how to create a range dynamically.

Say I have some data in a variable number of columns, in this example
3 - A, B, & C

Eg.

A B C
1
2
3 2 2 2
4 3 3 3
5 4 4 4

I want to write a sub/function that returns a range that contains all
the non-empty values in those columns.
I will know where the non-empty values begin, so all I need to find
out is the last non-empty cell, and create
a range out of this.

The range I want in this instance is: A3:D5

Can anyone help with this?

T

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Need to dynamically choose Ranges of non-empty objects

Hi Tom

Maybe you can use

Range("A3").CurrentRegion.Select

If you want to find the last cell in a range you can also look at this
http://www.rondebruin.nl/last.htm



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Tom O'Brien" wrote in message oups.com...
hello,

This is a basic questions... i have just started using vb....

I want to figure out how to create a range dynamically.

Say I have some data in a variable number of columns, in this example
3 - A, B, & C

Eg.

A B C
1
2
3 2 2 2
4 3 3 3
5 4 4 4

I want to write a sub/function that returns a range that contains all
the non-empty values in those columns.
I will know where the non-empty values begin, so all I need to find
out is the last non-empty cell, and create
a range out of this.

The range I want in this instance is: A3:D5

Can anyone help with this?

T

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Need to dynamically choose Ranges of non-empty objects

set rng = Range("A3").currentRegion
msgbox rng.Address

--
Regards,
Tom Ogilvy


"Tom O'Brien" wrote:

hello,

This is a basic questions... i have just started using vb....

I want to figure out how to create a range dynamically.

Say I have some data in a variable number of columns, in this example
3 - A, B, & C

Eg.

A B C
1
2
3 2 2 2
4 3 3 3
5 4 4 4

I want to write a sub/function that returns a range that contains all
the non-empty values in those columns.
I will know where the non-empty values begin, so all I need to find
out is the last non-empty cell, and create
a range out of this.

The range I want in this instance is: A3:D5

Can anyone help with this?

T


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
Dynamically Shifting Ranges RSquid Charts and Charting in Excel 1 July 31st 08 06:40 PM
How to specify cell ranges dynamically? Agent Wild Excel Worksheet Functions 5 June 7th 06 10:37 AM
Insert autoforms and objects dynamically Renton Excel Programming 0 July 22nd 05 11:12 PM
Dynamically Assign Objects to Form Objects. The Vision Thing Excel Programming 2 December 11th 04 04:02 PM
Dynamically finding the last empty row Mike Potocki Excel Programming 3 October 17th 03 04:34 PM


All times are GMT +1. The time now is 10:07 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"