+ Reply to Thread
Results 1 to 3 of 3

Count the total number of plan in a row

  1. #1
    Registered User
    Join Date
    03-23-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    67

    Count the total number of plan in a row

    I want to load the plan number in cell A1 to "until there is no more plan" in my Sheet3. My macro will give me 4 plan loaded, but in fact, there is only 3 plans!

    Where is the fix?

    Thanks

    Sub TestLoop() ' Main macro to be run

    Set rngList = wsSheet3.Range("A3:Z" & wsSheet3.Cells(wsSheet3.Rows.Count, 1).End(xlUp).Row)

    For lngSrc = 1 To rngList.Rows.Count
    MsgBox rngList.Cells(lngSrc, 1)
    Next lngSrc

    MsgBox lngSrc & " plan loaded! ", vbInformation, "Process Complete"

    End Sub

    Book1.xlsm

  2. #2
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Count the total number of plan in a row

    Please Login or Register  to view this content.
    increments to 4 which is why it doesn't go back for another round in the FOR/NEXT loop

    either -1 in the msgbox
    Please Login or Register  to view this content.
    or use a DO/while LOOP

    Please Login or Register  to view this content.
    Last edited by humdingaling; 08-14-2015 at 12:12 AM. Reason: edit
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Registered User
    Join Date
    03-23-2013
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    67

    Re: Count the total number of plan in a row

    Good to know! Thanks!

+ 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. Count the number of values required to sum to a total
    By LAUGHINGCROW in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-11-2014, 01:35 PM
  2. count total of a specific number a row
    By eznugget in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-15-2013, 07:03 PM
  3. Replies: 10
    Last Post: 05-11-2012, 02:14 AM
  4. Need to Count number of occurrences and get percentage of total
    By Bob Phillips in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 09-06-2005, 07:05 AM
  5. Need to Count number of occurrences and get percentage of total
    By JennLee in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 AM
  6. [SOLVED] Need to Count number of occurrences and get percentage of total
    By JennLee in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 11:05 PM
  7. [SOLVED] Need to Count number of occurrences and get percentage of total
    By JennLee in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-21-2005, 05:05 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