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

Hi there.

I want to use a loop in order to write into different, consecutiv
ranges. Therefore, i need to include the counting variable i in th
range definition. The expression below would be inside a loop:

Range(R[1]C[1+i]:R[2]C[1+i]).Select

Now the syntax is wrong... How SHOULD it be? Can I use the form

Range("A1:B1").Select

to do the same thing?

Range("A1"&i:"B1"&i).Select

doesnt work....

Cheers!

Fabaliciou

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Ranges / Loops

Hi
some ways:
Range("A"&i & ":"B"&i).Select

or
range(cells(i,1),cells(i,2)).select

note: in most cases it's to required to select the range
to process it


-----Original Message-----
Hi there.

I want to use a loop in order to write into different,

consecutive
ranges. Therefore, i need to include the counting

variable i in the
range definition. The expression below would be inside a

loop:

Range(R[1]C[1+i]:R[2]C[1+i]).Select

Now the syntax is wrong... How SHOULD it be? Can I use

the form

Range("A1:B1").Select

to do the same thing?

Range("A1"&i:"B1"&i).Select

doesnt work....

Cheers!

Fabalicious


---
Message posted from http://www.ExcelForum.com/

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Ranges / Loops

funzt. danke



--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default Ranges / Loops

Range(cells(1,1+i),cells(2,1+i)).select

Will select A1:A2 then B1:B2 and so forth as i increases
from 0. I think that's what you're trying to do. If you're
trying to move down columns, shift the variable onto the
other side of the "cells" references.

Cheers, Pete

-----Original Message-----
Hi there.

I want to use a loop in order to write into different,

consecutive
ranges. Therefore, i need to include the counting

variable i in the
range definition. The expression below would be inside a

loop:

Range(R[1]C[1+i]:R[2]C[1+i]).Select

Now the syntax is wrong... How SHOULD it be? Can I use

the form

Range("A1:B1").Select

to do the same thing?

Range("A1"&i:"B1"&i).Select

doesnt work....

Cheers!

Fabalicious


---
Message posted from http://www.ExcelForum.com/

.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Ranges / Loops

Sorry, your suggested code is way out.
There are various ways of doing the job, bearing in mind that the
Range() argument is usually a *String*.

When using numbers, this is probably the best :-
i = 1
Range(Cells(1, 1 + 1), Cells(2, 1 + i)).Select


Regards
BrianB
----------------------------------

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
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
loops???? harry buggy Excel Worksheet Functions 2 August 14th 07 06:33 PM
For next loops Kate Excel Discussion (Misc queries) 5 May 22nd 06 01:11 PM
Using For - Next Loops in VB Biomed New Users to Excel 1 March 21st 05 09:35 PM
Loops etc. Jonathan Vickers Excel Programming 6 February 28th 04 05:35 PM
LOOPS Fernando Duran Excel Programming 2 September 3rd 03 01:07 AM


All times are GMT +1. The time now is 01:55 AM.

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"