+ Reply to Thread
Results 1 to 4 of 4

difficulty with "for" loop

Hybrid View

ammartino44 difficulty with "for"... 01-09-2014, 03:22 PM
stnkynts Re: difficulty with "for"... 01-09-2014, 03:29 PM
ammartino44 Re: difficulty with "for"... 01-09-2014, 05:56 PM
stnkynts Re: difficulty with "for"... 01-09-2014, 06:35 PM
  1. #1
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: difficulty with "for" loop

    I think you need to recognize the distinction between 2 different variables iMyNumber and iMyNumber2. To help facilitate this, review this very similar code:

    Sub Example()
    Dim iLoop As Integer
    Dim iCount As Integer
    
    iCount = 0 'starting value
    
        For iLoop = 1 To 100
            iCount = iCount + 5
        Next iLoop
        
    MsgBox (iCount) 'gives ending value after adding 5, 100 times
    
    End Sub

  2. #2
    Forum Contributor
    Join Date
    08-14-2013
    Location
    LA Baby!!
    MS-Off Ver
    Excel 2007
    Posts
    1,598

    Re: difficulty with "for" loop

    Hmm. I understand the two variables, but I don't understand why you can put "imynumber" in the first example and it will add 1 each time but it won't do the same if I put "imynumber2" (without the +1).

+ 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] How to USE """"" cells count """"" change font color
    By austin123456 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-09-2013, 06:14 AM
  2. Replies: 2
    Last Post: 09-26-2013, 12:17 PM
  3. [SOLVED] Difficulty breaking link possibly caused by "Name" function.
    By navarreman1 in forum Excel General
    Replies: 1
    Last Post: 09-11-2013, 10:26 AM
  4. Having difficulty with VB on a button "Run-time error 1004"
    By andyaf in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-01-2013, 02:34 AM
  5. [SOLVED] Loop to check for "yes" then copy the IDs with "yes" and paste to other workbook
    By Hallet in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-11-2012, 12:41 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