LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Looping across two parallel ranges

I'm reaonably new to VBA in Excel, although I've done some icoding in Word
and Access.

Problem
--------
I want to take the text contents of cells in one named range (call it "A"),
and apply them as notes to a range of the same size elsewhere (Call this
range "B").

The two ranges could be of any rectangular shape, but the two ranges will
always be the same shape.

I'm having difficulty getting my head around how to use ranges.

If I get a handle on each range as an array, like:

src= Range("A")
tgt= Range("B")

then I only seem to be able to access the basic value of the cell. I.e.
"tgt" isn't an object, so I can't get to it's Comment property.

Alternatively if I get a Cell Range object with:

src= Range("A").Cells
tgt= Range("B").Cells

I'm having trouble getting the count of the rows/columns in each range so I
can write a nested loop to work through all the Cells.

This has to be simple but I havn't found the right incantation yet. Most
examples use something like:

For Each C In Range("A").Cells
....
Next

This is great for accessing cells in one range, but not easy to work between
two ranges at the same time. Ideas/pointers would be great.

Regards: Colin
 
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
Looping in VB with cell ranges Freeman Excel Worksheet Functions 2 January 22nd 06 12:14 PM
Any easier way than looping on ranges Billabong Excel Programming 1 August 27th 04 10:32 AM
looping through ranges: how to speed up? fra Excel Programming 8 June 29th 04 03:38 AM
Looping through Ranges of Rows MS News Excel Programming 6 December 9th 03 06:13 AM
Looping through Ranges of Rows MS News Excel Programming 0 December 8th 03 11:42 AM


All times are GMT +1. The time now is 06:10 PM.

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"