1. You are viewing our forum as a guest. For full access please Register. WindowsBBS.com is completely free, paid for by advertisers and donations.

Visual Basic in Excel 2010

Discussion in 'Other PC Software' started by 71sigma, 2014/05/05.

  1. 2014/05/05
    71sigma

    71sigma Inactive Thread Starter

    Joined:
    2002/03/27
    Messages:
    49
    Likes Received:
    0
    Windows 7 does not support QBasic.

    Excel 2010 Macros no longer support For-Next or other "loop" code.

    Visual Basic within Excel 2010 appears to be able to use code very much like QBasic. And therein lies a tale. Many years ago I created a QBasic program to process Lottery numbers to accomplish two goals.

    One: determine which numbers were called most frequently.

    Two: Which pairs of numbers were called most frequently. "Pairs of numbers" defined: Given the numbers 2, 4, 8, 22 and 35 the "pairs" would be 2-4, 2-8, 2-22, 2-35, 4-2, 4-8, 4-22, 4-35 and so forth through 35-22. These "pairs" were accumulated in a 39 by 39 array (or call it a matrix or grid if you want).

    Process number one above can be, and is, easily accomplished in Excel 2010 (my Lottery records through December 2010 contain 6,138 records, and I easily extract the 5 lottery numbers from each record, then add the totals and sort the results).

    I'm stuck on how to accomplish process number two. I need to use a "loop" to access the raw records one at a time and build the 39 by 39 array. I'm fairly certain the code exactly like, or very similar to, my QBasic code can be done in Visual Basic (within Excel 2010). My problem is that I cannot figure out how many VB "objects" I need and which ones.

    It is my understanding that VB is very particular where code is placed, but where and when escape me. I do not need any fancy "user interface" since I will be the only user. Who wants to help?
     
  2. 2014/05/07
    TonyT

    TonyT SuperGeek Staff

    Joined:
    2002/01/18
    Messages:
    9,072
    Likes Received:
    400

  3. to hide this advert.

  4. 2014/05/08
    71sigma

    71sigma Inactive Thread Starter

    Joined:
    2002/03/27
    Messages:
    49
    Likes Received:
    0
    Thanks for the link TonyT, but it didn't get me where I want to go.
    The link gave several methods of "looping" WITHIN Visual Basic.
    I really need to know more about creating the VB environment in order to put the code that I already know into the proper object in order to compile a short program similar to the QBasic program that I need to replace. By the way, Microsoft uses the term "macro" to refer to both Visual Basic code and less powerful macros written directly into a work sheet.
    Thanks anyway.
    71sigma
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.