+ Reply to Thread
Results 1 to 9 of 9

Unknown function of code

  1. #1
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Usually at work, in the UK
    MS-Off Ver
    Excel 2010
    Posts
    639

    Unknown function of code

    Please Login or Register  to view this content.
    Can anyone explain what the (3 * i) part of this code is doing?

    Please
    Last edited by Sc0tt1e; 03-25-2014 at 06:31 PM.

  2. #2
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Unknown function of code

    It is multiplying value of i with 3.

    It appears this code is storing reference to each third column from column 53
    • Please remember to mark threads Solved with Thread Tools link at top of page.
    • Please use code tags when posting code: [code]Place your code here[/code]
    • Please read Forum Rules

  3. #3
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Usually at work, in the UK
    MS-Off Ver
    Excel 2010
    Posts
    639

    Re: Unknown function of code

    What is the i part referring to?

  4. #4
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Unknown function of code

    it is probably a loop variable - you haven't posted enough code to be completely sure but it would be strange otherwise. ;-)
    Last edited by JosephP; 03-26-2014 at 07:25 AM.
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  5. #5
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Usually at work, in the UK
    MS-Off Ver
    Excel 2010
    Posts
    639

    Re: Unknown function of code

    Actually, I'm more interested in the * aspect. From my experience with excel * is equal to multiple, I am curious to what it stands for in this instance.

    I kind of guess that (e.g.) If i = 12 then it starts at 12 and then finds the 3rd cell/row from 12.

    If it loops, I am guessing it keeps looking for the 3rd cell/row from the last result?

    If I'm correct then cool, I'm starting to get it but I still don't get the * in the code

  6. #6
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Usually at work, in the UK
    MS-Off Ver
    Excel 2010
    Posts
    639

    Re: Unknown function of code

    There is more code that defines "ApplymyFormat" but I left it out as it is not relevant. But here is total code for reference

    Please Login or Register  to view this content.

  7. #7
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Unknown function of code

    * = multiply

    If i = 3, CellRef(3) will be set to S2LI.Cells(RowNumba, 53 + (3 *3)) which is column 62
    When i = 4, CellRef(4) will be set to S2LI.Cells(RowNumba, 53 + (3 *4)) which is column 65
    et cetera.

  8. #8
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Usually at work, in the UK
    MS-Off Ver
    Excel 2010
    Posts
    639

    Re: Unknown function of code

    Aaaaaaaarrrrrrrrrrrrggggggggggghhhhhhhhhhhhhhhhhhhh!!!!!!!

    What a duffus, I'm sitting here thinking why is it multiplying. I'm thinking the loop moves so it's multiplying off the offset, I didn't realise the start point remains static. In that case it makes a lot of sense, and makes me feel a little bit silly lol.

    Cheers guys.

    However I have tried this and it only pastes the first line, it doesn't work on lines 2+, can anyone see anything wrong with the code?

  9. #9
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Unknown function of code

    May you post workbook? If CellRef item is empty then code will not populate a row.

+ 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] Using code to select a cell directly below a range of an unknown size
    By LaffyAffy13 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-01-2013, 11:44 AM
  2. Code is making changes for unknown reason
    By BonsaiJoe in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-09-2012, 06:11 PM
  3. Unknown error in VBA code
    By mjhopler in forum Excel General
    Replies: 4
    Last Post: 06-03-2011, 01:09 PM
  4. Unknown code
    By Peter1999 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-13-2007, 06:06 AM
  5. Unknown problem with simple VBA code
    By norika in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-21-2005, 01:05 AM

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