Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How does .offset(i, counter) work?
Hi everypne,
How does the following piece of code work: With Range("G2") For i = 1 To 30 .Offset(i, ModelCounter) = Range("Picked").Cells(i) Next End With In particular the offset line please! Thanks, Mike |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How does .offset(i, counter) work?
Mike
The With/End With construct says that cell G2 is the reference cell. The ".Offset(i, ModelCounter)" says "the cell that is "i" rows down and "ModelCounter" columns to the right (if ModelCounter is positive) from G2. HTH Otto "Mike" wrote in message oups.com... Hi everypne, How does the following piece of code work: With Range("G2") For i = 1 To 30 .Offset(i, ModelCounter) = Range("Picked").Cells(i) Next End With In particular the offset line please! Thanks, Mike |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How does .offset(i, counter) work?
With Range("G2") For i = 1 To 30 .Offset(i, ModelCounter) = Range("Picked").Cells(i) Next End With The above script enters data into cell G2 + i rows + ModelCounte columns And gets data from the range "Picked", cell number i. So basically, it goes down the 30 rows according to i, taking the i't cell from "Picked" and puts it in G2 + ModelCounter columns and rows. So if ModelCounter is 4, it will start in K3, K4, K5 ..... -- dspence ----------------------------------------------------------------------- dspencer's Profile: http://www.excelforum.com/member.php...fo&userid=3096 View this thread: http://www.excelforum.com/showthread.php?threadid=50636 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
How does .offset(i, counter) work?
Dspencer,
As a follows up on the last line of your reply, say I want it to start in K2 instead of K3, What change should I make? Thanks alot in advance, Mike |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
How does .offset(i, counter) work?
With range("G1")
would do. "Mike" wrote: Dspencer, As a follows up on the last line of your reply, say I want it to start in K2 instead of K3, What change should I make? Thanks alot in advance, Mike |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Compare Cell Values, Offset(-1,0), Offset(-1,-1), and xlFillDefaul | Excel Worksheet Functions | |||
activecell.offset does not work | Excel Programming | |||
Trouble getting the OFFSET fo work | Excel Programming | |||
Counter | Excel Programming | |||
Counter | Excel Programming |