Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 98
Default Defining a variable Range for cells with values in them!

Hi:

I appear to be asking a number of questions about definitions of variable ranges.

I have a range which at its maximum goes from a1:q500

I want to select ALL rows that have a value (non blank) in column A. They will be
sequential so that Selection.End(xlDown).Select and then adding to the column to get
to Q would work. The trouble I am having is with the Range(x:y).Select, where i cant
get the variables set up right!

Having tried various ways, I find I am stuck.

Incidentally, this group is amazing! 99.999% of the stupid questions I have asked have
been answered. I am eternally grateful!

Best

John Baker
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Defining a variable Range for cells with values in them!

Set rng = Range("A1").CurrentRegion
rng.Select

should define the area of your data.

if you want to know the last cell

msgbox rng(rng.count).Address

x = rng(rng.count).row
y = rng(rng.count).column

msgbox "x: " & x & ", y: " & y

if you want to refer to an area within the range

rng(10,3) would be C3

rng(1,1) would be A1

Range(x,y) is invalid syntax if x means row and y means column. Cells(x,y)
would be valid.

--
Regards,
Tom Ogilvy

"John Baker" wrote in message
...
Hi:

I appear to be asking a number of questions about definitions of variable

ranges.

I have a range which at its maximum goes from a1:q500

I want to select ALL rows that have a value (non blank) in column A. They

will be
sequential so that Selection.End(xlDown).Select and then adding to the

column to get
to Q would work. The trouble I am having is with the

Range(x:y).Select, where i cant
get the variables set up right!

Having tried various ways, I find I am stuck.

Incidentally, this group is amazing! 99.999% of the stupid questions I

have asked have
been answered. I am eternally grateful!

Best

John Baker



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
defining unique range of cells for different sheets as the same n. KSAPP Excel Discussion (Misc queries) 1 March 30th 05 07:18 PM
Drop down defining content of a range of cells philm13 Links and Linking in Excel 5 March 25th 05 03:31 PM
Defining a Variable Range Dave Peterson[_5_] Excel Programming 0 January 19th 05 02:30 AM
Defining a variable within a sub... aking1987[_3_] Excel Programming 1 November 11th 04 01:12 PM
Error 1004 when defining range by cells(r,c) format dave Excel Programming 8 May 18th 04 08:51 PM


All times are GMT +1. The time now is 04:51 PM.

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"