+ Reply to Thread
Results 1 to 5 of 5

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

  1. #1
    Registered User
    Join Date
    08-09-2013
    Location
    NY
    MS-Off Ver
    Excel 2010
    Posts
    39

    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. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Excel 2016
    Posts
    10,032

    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
    HTH
    Regards, Jeff

  3. #3
    Registered User
    Join Date
    08-09-2013
    Location
    NY
    MS-Off Ver
    Excel 2010
    Posts
    39

    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. #4
    Forum Contributor
    Join Date
    07-30-2013
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    121

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

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

  5. #5
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Excel 2016
    Posts
    10,032

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

    Yes you are right, I got them backwards.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Excel 2010 -- "Visual Basic" "Macros" and "Record Macro" all disabled.
    By NicholasL in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-07-2017, 06:11 AM
  2. Need "reverse" amortization; calculate loan amount
    By Niek Otten in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-06-2005, 06:05 AM
  3. Need "reverse" amortization; calculate loan amount
    By MLSanders in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 AM
  4. [SOLVED] Need "reverse" amortization; calculate loan amount
    By MLSanders in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 11:05 PM
  5. Need "reverse" amortization; calculate loan amount
    By MLSanders in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-27-2005, 12:05 PM

Bookmarks

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