Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 553
Default LOOPING STRUCTURE DESIRED 4 TWO RANGES

I have two ranges as follows:
A1:A5 with values A, B, C, D, E (R1)
and
B1:B5 with values 1, 2, 3, 4, 5 (R2)

What kind of looping structure would lead to display:
A1
B2
C3
D4
E5
in message boxes? Following code displays unwanted entries like:
A1, A2, A3, A4, A5, B1, B2, B3, B4, B5, C1, C2, C3, C4, C5, D1, D2, D3, D4,
D5, E1, E2, E3, E4, E5
---
For Each MYC In R1
For Each MYC2 In R2
MsgBox MYC.Value & ", " & MYC2.Value
Next MYC2
Next MYC
---
How 2 overcome this problem???

Thanx in advance for all tyour expertise.

Best Regards
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,480
Default LOOPING STRUCTURE DESIRED 4 TWO RANGES

Hi

Try

For Each MYC In R1
MsgBox MYC.Value & ", " & Offset(MYC,1,0).Value
Next MYC


--
Regards
Roger Govier

"FARAZ QURESHI" wrote in message
...
I have two ranges as follows:
A1:A5 with values A, B, C, D, E (R1)
and
B1:B5 with values 1, 2, 3, 4, 5 (R2)

What kind of looping structure would lead to display:
A1
B2
C3
D4
E5
in message boxes? Following code displays unwanted entries like:
A1, A2, A3, A4, A5, B1, B2, B3, B4, B5, C1, C2, C3, C4, C5, D1, D2, D3,
D4,
D5, E1, E2, E3, E4, E5
---
For Each MYC In R1
For Each MYC2 In R2
MsgBox MYC.Value & ", " & MYC2.Value
Next MYC2
Next MYC
---
How 2 overcome this problem???

Thanx in advance for all tyour expertise.

Best Regards


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 553
Default LOOPING STRUCTURE DESIRED 4 TWO RANGES

Thanx Roger,

But it was actually an example. The problem is that the ranges might be any.
Any way other than Offset???

Thanx again.

"Roger Govier" wrote:

Hi

Try

For Each MYC In R1
MsgBox MYC.Value & ", " & Offset(MYC,1,0).Value
Next MYC


--
Regards
Roger Govier

"FARAZ QURESHI" wrote in message
...
I have two ranges as follows:
A1:A5 with values A, B, C, D, E (R1)
and
B1:B5 with values 1, 2, 3, 4, 5 (R2)

What kind of looping structure would lead to display:
A1
B2
C3
D4
E5
in message boxes? Following code displays unwanted entries like:
A1, A2, A3, A4, A5, B1, B2, B3, B4, B5, C1, C2, C3, C4, C5, D1, D2, D3,
D4,
D5, E1, E2, E3, E4, E5
---
For Each MYC In R1
For Each MYC2 In R2
MsgBox MYC.Value & ", " & MYC2.Value
Next MYC2
Next MYC
---
How 2 overcome this problem???

Thanx in advance for all tyour expertise.

Best Regards



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
LOOPING multiple ranges Jase Excel Discussion (Misc queries) 1 April 7th 08 06:21 PM
which function can get the desired result? ADK Excel Worksheet Functions 3 May 9th 07 03:10 PM
IRR desired return izbix Excel Worksheet Functions 3 May 3rd 07 06:47 AM
Simplicity is Desired natei6 Excel Worksheet Functions 8 April 11th 06 07:10 AM
Looping in VB with cell ranges Freeman Excel Worksheet Functions 2 January 22nd 06 12:14 PM


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