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

Hi:
two questions:
1. How does excel define aegion of cells?
2. How can I determine the regions of cells in a worksheet and the rane of
cell with any of the defined regions?
Any help apreciated.
Sean


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default excel regions

"Region" is not an Excel term but "CurrentRegion" is a block of cells where
each row and each column contains at least one cell which is not empty.
Actually help defines it better as
"The current region is a range bounded by any combination of blank rows and
blank columns."

Dim rCR as range
Set rCR = ActiveSheet.Range("C1").CurrentRegion

msgbox rCR.Address

There is no direct way to list all 'regions' on a sheet other than by
looping non empty cells and finding new CurrentRegion's.

Regards,
Peter T




"Sean Farrow" wrote in message
...
Hi:
two questions:
1. How does excel define aegion of cells?
2. How can I determine the regions of cells in a worksheet and the rane of
cell with any of the defined regions?
Any help apreciated.
Sean



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default excel regions

While it is true that there is no way to list all the CurrentRegions,
perhaps this listing of 'cells in use' will suffice for the OP's needs...

Sub GetRegions()
Dim X As Long
Dim Regions As String
Dim FilledCells As Range
Set FilledCells = Union(Selection.SpecialCells(xlCellTypeConstants), _
Selection.SpecialCells(xlCellTypeFormulas))
Regions = Replace(FilledCells.Address, ",", vbLf)
MsgBox Regions
End Sub

--
Rick (MVP - Excel)


"Peter T" <peter_t@discussions wrote in message
...
"Region" is not an Excel term but "CurrentRegion" is a block of cells
where each row and each column contains at least one cell which is not
empty. Actually help defines it better as
"The current region is a range bounded by any combination of blank rows
and blank columns."

Dim rCR as range
Set rCR = ActiveSheet.Range("C1").CurrentRegion

msgbox rCR.Address

There is no direct way to list all 'regions' on a sheet other than by
looping non empty cells and finding new CurrentRegion's.

Regards,
Peter T




"Sean Farrow" wrote in message
...
Hi:
two questions:
1. How does excel define aegion of cells?
2. How can I determine the regions of cells in a worksheet and the rane
of cell with any of the defined regions?
Any help apreciated.
Sean




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default excel regions

Not sure about that Rick. As written would error unless the selection
contained both constants and formulas. Also the address will truncate if/as
it approaches 255, though that could be worked around by looping areas.

Regards,
Peter T



"Rick Rothstein" wrote in message
...
While it is true that there is no way to list all the CurrentRegions,
perhaps this listing of 'cells in use' will suffice for the OP's needs...

Sub GetRegions()
Dim X As Long
Dim Regions As String
Dim FilledCells As Range
Set FilledCells = Union(Selection.SpecialCells(xlCellTypeConstants), _
Selection.SpecialCells(xlCellTypeFormulas))
Regions = Replace(FilledCells.Address, ",", vbLf)
MsgBox Regions
End Sub

--
Rick (MVP - Excel)


"Peter T" <peter_t@discussions wrote in message
...
"Region" is not an Excel term but "CurrentRegion" is a block of cells
where each row and each column contains at least one cell which is not
empty. Actually help defines it better as
"The current region is a range bounded by any combination of blank rows
and blank columns."

Dim rCR as range
Set rCR = ActiveSheet.Range("C1").CurrentRegion

msgbox rCR.Address

There is no direct way to list all 'regions' on a sheet other than by
looping non empty cells and finding new CurrentRegion's.

Regards,
Peter T




"Sean Farrow" wrote in message
...
Hi:
two questions:
1. How does excel define aegion of cells?
2. How can I determine the regions of cells in a worksheet and the rane
of cell with any of the defined regions?
Any help apreciated.
Sean






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
Regions of Constant Slope Lex Excel Discussion (Misc queries) 1 June 2nd 10 08:32 PM
How do I draw a quadrant with coloured regions in Excel? Sarabjit Excel Discussion (Misc queries) 3 June 29th 07 01:18 PM
Defining Regions with Names Elise148 Excel Discussion (Misc queries) 3 June 13th 07 02:19 PM
Locking rows or Regions in Excel worksheets Pat Dools Excel Worksheet Functions 0 August 11th 06 03:00 PM
How to Combine Data Regions Orlanzo Excel Programming 3 January 24th 06 10:11 PM


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