Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default using RANGE object in multiple-area range

If I want to search a "block" of cells this code will search across columns
then by rows, is there anyway to search all of the rows in a column before
moving to the next row? In other words colum A rows1 1-10, col B rows
1-10...etc instead of A1, B1, C1, A2, B2, C2
Thanks

Function jjj()
Dim terry As Range
Set terry = Worksheets(1).Range("A1:C3")
For Each x In terry
MsgBox x.Value
Next x
End Function


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default using RANGE object in multiple-area range

You can use this

Set terry = Worksheets(1).Range("A1:A10,B1:B10")


--
Regards Ron de Bruin
http://www.rondebruin.nl


"TerryT" wrote in message ...
If I want to search a "block" of cells this code will search across columns
then by rows, is there anyway to search all of the rows in a column before
moving to the next row? In other words colum A rows1 1-10, col B rows
1-10...etc instead of A1, B1, C1, A2, B2, C2
Thanks

Function jjj()
Dim terry As Range
Set terry = Worksheets(1).Range("A1:C3")
For Each x In terry
MsgBox x.Value
Next x
End Function




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 783
Default using RANGE object in multiple-area range

TerryT wrote:
If I want to search a "block" of cells this code will search across columns
then by rows, is there anyway to search all of the rows in a column before
moving to the next row? In other words colum A rows1 1-10, col B rows
1-10...etc instead of A1, B1, C1, A2, B2, C2
Thanks

Function jjj()
Dim terry As Range
Set terry = Worksheets(1).Range("A1:C3")
For Each x In terry
MsgBox x.Value
Next x
End Function



I don't know if it's useful for you, but the For...Each structure
traverses arrays differently from ranges; down the columns:

Function jjj()
Dim terry As Variant
terry = Worksheets(1).Range("A1:C3")
For Each x In terry
MsgBox x
Next x
End Function

Alan Beban
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 690
Default using RANGE object in multiple-area range

Would this idea help?

Sub Demo()
Dim Col As Range
Dim Cell As Range
For Each Col In Range("A1:C3").Columns
For Each Cell In Col.Cells
Debug.Print Cell.Address
Next Cell
Next Col
Debug.Print
End Sub

Returns:
$A$1
$A$2
$A$3
$B$1
$B$2
....
$C$3

HTH
--
Dana DeLouis
Win XP & Office 2003


"TerryT" wrote in message
...
If I want to search a "block" of cells this code will search across
columns
then by rows, is there anyway to search all of the rows in a column before
moving to the next row? In other words colum A rows1 1-10, col B rows
1-10...etc instead of A1, B1, C1, A2, B2, C2
Thanks

Function jjj()
Dim terry As Range
Set terry = Worksheets(1).Range("A1:C3")
For Each x In terry
MsgBox x.Value
Next x
End Function




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
Excel Addin:Setting the range to the Excel.Range object range prop Rp007 Excel Worksheet Functions 5 November 24th 06 04:30 PM
returning pivottable object from a range object Grant Excel Programming 2 September 27th 04 02:22 AM
Adding named range gives error "method range of object _Global failed " Gunnar Johansson Excel Programming 3 August 10th 04 01:54 PM
Range object to Array object conversion Myrna Larson[_2_] Excel Programming 1 August 1st 03 02:27 AM
Range object to Array object conversion Alan Beban[_3_] Excel Programming 0 August 1st 03 01:24 AM


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