+ Reply to Thread
Results 1 to 6 of 6

Help explaining code

  1. #1
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Help explaining code

    If anyone can help I have a macro that isn't working correctly and i can't get in touch with the person that wrote it at this time. I think the problem lies in the full code below but there is a line in the code I don't understand. Can someone explain what the line
    Please Login or Register  to view this content.
    is telling the program to do? I think I grasp what the first part is saying but not the"+38 - 1" part.
    Thanks in advance for any explanation

    Please Login or Register  to view this content.
    Last edited by WasWodge; 11-13-2010 at 08:38 PM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,963

    Re: Help explaining code

    Think of it as in brackets:

    Please Login or Register  to view this content.

    Please Login or Register  to view this content.

    So, I'm not sure what s/he had in mind but that's looping through 37 rows of data starting at whatever value is in fRow. By default, the step between the to and from values is 1.

    It might be to show whatever calculation was going on ... who knows?


    Regards
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: Help explaining code

    That does actually make sense now I understand exactly what they have written as I know what they were afler. It would have made a bit more sense to you if I could have posted more code or the workbooks but I had to keep it to a bare minimum. I should be able to correct it from there. Thanks for your help.

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Help explaining code

    Hello paul555555,

    On a side note, the one is subtracted from the 38 to include the first row in the count.

    For example, if you want to loop form rows 1 to 5. If 5 is added to 1 the result is 6. Subtract 1 and the last row is 5. This works with number. If your first row is 2 and you want to loop to row 10 then 2 + 10 - 1 = 11.Counting from row 2 to 11 is 10 rows, inclusive.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  5. #5
    Valued Forum Contributor WasWodge's Avatar
    Join Date
    08-02-2010
    Location
    Hampshire,England
    MS-Off Ver
    Office 365 and Office 2010
    Posts
    882

    Re: Help explaining code

    Thanks for the further information, Leith. At least I can relay it to him what (AND WHY) I altered when I see him in a fortnight as I have it running correctly now.

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,963

    Re: Help explaining code

    Excellent. Thanks for the feedback.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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