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: 6
Default Loop with variable

I'm trying to use i as variable to loop through three ranges, with no luck..
what am I doing wrong?

Dim TRange1, TRange2, TRange3 As Range

Set TRange1 = Worksheets("Test").Range("B8:H17")
Set TRange2 = Worksheets("Test").Range("B20:H29")
Set TRange3 = Worksheets("Test").Range("B32:H41")
i = 1
For i = 1 To 5
For Each myCell In TRange(i).Cells
--do sth here
Next
i=i+1
next i

knut


 
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
Loop with variable name? Mike Excel Discussion (Misc queries) 6 April 25th 09 05:12 AM
How to set a variable in Excel and loop frankeps Excel Programming 2 October 26th 04 11:59 AM
Creating a formula using the loop variable Spector Excel Programming 1 October 22nd 04 07:42 PM
Excel VBA Loop & Variable Reference Carolyn[_4_] Excel Programming 2 October 15th 04 08:30 PM
Re-assigning the value of a variable for a for loop from Mike Berry Excel Programming 1 July 16th 03 02:41 PM


All times are GMT +1. The time now is 11:14 AM.

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"