+ Reply to Thread
Results 1 to 2 of 2

Help Rewriting With Loops

  1. #1
    Registered User
    Join Date
    09-05-2016
    Location
    illinois
    MS-Off Ver
    2013
    Posts
    4

    Help Rewriting With Loops

    Hello, I wrote some code the other day and I'm excited that it even works. It's just messy without a loop. I tried to read up on loops and I'm a little lost.

    Basically, my code adds up each row and then sets each cell to 0. It will add to your total each time you hit the button.

    Also, can someone throw in the code on how to 'print' out a variable, so I can see what my loops are doing.

    Here is my code:
    Please Login or Register  to view this content.
    Last edited by naturaldissolve; 09-10-2016 at 03:14 AM.

  2. #2
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: Help Rewriting With Loops

    Here are two ALTERNATIVES for loops. My preference is for the second one, but I assume the first one would be more clear for you

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    In the second one there are two Debug.Print statements that write to Immediate window and show the result before and after
    If you are pleased with a member's answer then use the Star icon to rate it.

+ 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. Need help rewriting existing formulas please
    By [email protected] in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-01-2016, 04:43 PM
  2. Help rewriting code to use less memory
    By Karl Gustaf Karsten in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-23-2016, 12:56 PM
  3. Rewriting Data Results in #REF
    By katybailey in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-11-2013, 02:18 PM
  4. Rewriting the AND expression
    By lazyme in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-15-2007, 06:43 PM
  5. [SOLVED] Rewriting equation for VB
    By Barb Reinhardt in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-08-2006, 03:35 PM
  6. Rewriting a formula...
    By Roz in forum Excel General
    Replies: 3
    Last Post: 01-06-2006, 12:15 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