# Excel handles (x,y) in reverse? "i" definers?

1. ## Excel handles (x,y) in reverse? "i" definers?

I'm trying to teach myself the basics and this has been messing with me for a while. When trying to define a range of cells I've been looking at something like Range(Cells(x, y), Cells(x, y)). However the "x" seems to be designation for the row (aka moving vertically through the spreadsheet along the y axis) and "y" seems to be the designation for the column (aka moving horizontally through the spreadsheet along the x axis).

Is there a reason for this I can use to justify it in my brain? "It just does" doesn't seem to be working as I often catch myself doing the opposite due to years basic math.

Also while I'm asking silly questions, can anyone assist me in the purpose of using "i" as a definer? Through trial and error I can see that something like "For i = 2 To i = 5" designates rows 2 through 5.. but I doubt very much that "i" means row. What does "i" mean?

Thanks.

2. ## Re: Excel handles (x,y) in reverse? "i" definers?

Hello & Welcome to the Forum,

"i" is just used as a variable. Some may say its just a lazy way to declare a variable, but its up to you the author.

It simply comes down to your coding style and how well you want the variable to represent what you mean.

http://support.microsoft.com/kb/843144
http://www.cpearson.com/excel/DeclaringVariables.aspx
http://stackoverflow.com/questions/1...best-practices

As far as the Range(Cells(x, y), Cells(x, y)), this would mean...

Range(Cells([RowIndex], [ColumnIndex]), Cells([RowIndex], [ColumnIndex]))

http://msdn.microsoft.com/en-us/libr.../ff194567.aspx
http://msdn.microsoft.com/en-us/libr.../ff838238.aspx

``Please Login or Register  to view this content.``
Take the example above. We established the last row by finding the last filled cells in column A and called it lngLastRow.

Normally I would just call it LR, but if I want to get more specific, the variable is declared as Long and it is the Last Row.

In the end, the code copies A1:J10

3. ## Re: Excel handles (x,y) in reverse? "i" definers?

Shouldn't that be Cells(lngLastRow, 10) then if x=row? This is what I mean by confusion! It really should be the other way around

4. ## Re: Excel handles (x,y) in reverse? "i" definers?

Try FORMAT AXIS, Values in Reverse Order for the value that is incorrect.

5. ## Re: Excel handles (x,y) in reverse? "i" definers?

Yes you are right, I got them backwards.

There are currently 1 users browsing this thread. (0 members and 1 guests)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1