Matt,
What is happening here is that often we have a way, in code, of identifying
a particular instance, say the last cell in column A that has data in it
(which is what the Cells(Rows.Count, "A").End(xlUp).Row does, or at least
the row of that). But the cell that you can identify may not be the cell
that you want to change, it may be some columns to the left or right, or
rows above or below. This is where you find Offset useful.
Offset(x,y) will identify a cell x rows and y columns beyond the cell
already identified (note that x can be negative for rows above, y can be
negative for columns left). So in my example, having found the cell in
column A (Cells(i, "A")), I use offset to get the cell 2 columns to the
right (.Offset(0, 2)).
--
HTH
Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
"iomighty " wrote in message
...
Thanks Bob,
Info like this is how I am building my Excel knowledge. Unfortuantely
I am teaching myself by looking at poeple's examples and then trying to
replicate them to understand how the instructions work. This may
sound like a naive question, but when you write " If Cells(i,
"A").Offset(0, 2).Value" in the above example: - What does the
"Offset(0,2).Value" relate to.
I have used it a few times in building simple instructions without
knowing exactly its' reference.
And again I want to express the appreciation I have for so many people
on this forumn that take the time every day to answer these odd
questions. I have learned so much here, more so than from the books I
use for reference.
Cheers,
Matt
---
Message posted from http://www.ExcelForum.com/