+ Reply to Thread
Results 1 to 6 of 6

Need explanation of one line of a VBA do loop code

  1. #1
    Registered User
    Join Date
    08-19-2006
    Location
    New York, NY
    MS-Off Ver
    MS Office 2013
    Posts
    33

    Need explanation of one line of a VBA do loop code

    Hello,

    I am reading this book on learning VBA and I am confused by one of the codes.

    The following illustrates using the above style Do..Loop to insert blank rows every five rows, until a blank cell is encountered:"

    Please Login or Register  to view this content.
    I can follow the code until "Set cellToUse = cellToUse.Offset(5, 0)."

    Can someone explain to me in layman terms what is happening there?

    Thanks!
    Last edited by topnotchthrillr; 02-27-2014 at 02:23 PM. Reason: To comply with forum rules

  2. #2
    Forum Contributor
    Join Date
    04-24-2007
    Location
    NYC
    MS-Off Ver
    2k3/2k7/2010
    Posts
    270

    Re: VBA newbie needs help with code

    it is getting the location of the next 5th row and saving that location in "cellToUse".

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,199

    Re: VBA newbie needs help with code

    Hi, topnotchthrillr,

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: VBA newbie needs help with code

    Please take a moment to read the forum rules and then amend your thread title to something descriptive of your problem. Once you have done this please send me a PM and I will remove this request.

    To change a Title on your post, click EDIT POST then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  5. #5
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    12,996

    Re: Need explanation of one line of a VBA do loop code

    Set cellToUse = cellToUse.Offset(5, 0) merely replaces the current cell's data in the CellToUse variable with that of the cell five rows down.
    Ben Van Johnson

  6. #6
    Registered User
    Join Date
    08-19-2006
    Location
    New York, NY
    MS-Off Ver
    MS Office 2013
    Posts
    33

    Re: Need explanation of one line of a VBA do loop code

    Thanks you. Now it makes sense!

+ 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. Code Review for newbie
    By thisandthat in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-03-2014, 08:06 PM
  2. newbie.... need some code... I HOPE!
    By beechum1 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-17-2006, 03:47 PM
  3. newbie help - code need correcting
    By haitch2 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-16-2005, 01:16 PM
  4. [SOLVED] Why this code works and other do not? Newbie here.
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-10-2005, 09: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