Welcome Guest
Log In | Register )
You last visited December 2, 2016, 5:18 pm
All times shown are
Eastern Time (GMT-5:00)

Visual Basic Help

Topic closed. 4 replies. Last post 7 months ago by AllenB.

Page 1 of 1
PrintE-mailLink
Avatar
Lincoln, California
United States
Member #167130
June 27, 2015
256 Posts
Offline
Posted: April 30, 2016, 12:14 pm - IP Logged

When it comes to Macros, I am a step-cut-paste creator.  I need to learn.  I need a simple counter in a macro that will run an application a specified number of times. 

Pretty basic, I would look it up; but, my brain is fried from the Step-Cut-Paste Shuffle.

Thanks

    Todd's avatar - Cylon 2.gif
    Chief Bottle Washer
    New Jersey
    United States
    Member #1
    May 31, 2000
    23259 Posts
    Offline
    Posted: April 30, 2016, 3:31 pm - IP Logged

    <Moved to Lottery Discussion forum>

    Please post in the appropriate forum ... thank you.

      Avatar

      United States
      Member #132100
      August 26, 2012
      1076 Posts
      Offline
      Posted: May 1, 2016, 5:27 am - IP Logged

      When it comes to Macros, I am a step-cut-paste creator.  I need to learn.  I need a simple counter in a macro that will run an application a specified number of times. 

      Pretty basic, I would look it up; but, my brain is fried from the Step-Cut-Paste Shuffle.

      Thanks

      Seems to me that you are in the wrong Web site to ask for such.

      And that also my posting this is a waste of my time.

      https://msdn.microsoft.com/en-us/library/5z06z1kb.aspx

      http://www.wiseowl.co.uk/blog/s193/vba-for-next.htm

      http://www.fontstuff.com/ebooks/free/fscodeloops.pdf

      http://www.classanytime.com/mis333k/sjloopsarrays.html

      http://www.vb6.us/tutorials/understanding-do-and-while-loops

      http://academic2.strose.edu/math_and_science/avitabij/cis321/vba/vb1.htm

      https://msdn.microsoft.com/en-us/library/cc295385.aspx

      http://www.tutorialspoint.com/vba/

      That is probably not what you want, but that is all that I found.

      I didn't post some links because you didn't say "Microsoft Excel" macro and I don't know anything about such things anyway.

        Avatar

        United States
        Member #41846
        June 23, 2006
        458 Posts
        Offline
        Posted: May 1, 2016, 6:26 am - IP Logged

        the basic  for next loop works for this. there are other methods.

        within your macro

        for x=1 to 50'  use any valid variable name and value that you want here

        your code as many lines as you need

        next x'  if you used x in the "for" statement you must use x in the "next" statement. x cannot be used in your code.  x can be any valid variable name

         

        that works great if you have a fixed number of loops. the values can be variables. ex

        bgn=1:en_d=50 

        for x=bgn to en_d

        code

        next x

         

        you can pass this info from your spreadsheet. ex  cell a1 is your begin at number  cell b1 is your end number

        bgn=cells(a1):en_d=cells(b1)

        for x=bgn to en_d

        code

        next x

         

        hope this helps you.  check gasmeterguy blog .

          Avatar
          Lincoln, California
          United States
          Member #167130
          June 27, 2015
          256 Posts
          Offline
          Posted: May 1, 2016, 6:21 pm - IP Logged

          the basic  for next loop works for this. there are other methods.

          within your macro

          for x=1 to 50'  use any valid variable name and value that you want here

          your code as many lines as you need

          next x'  if you used x in the "for" statement you must use x in the "next" statement. x cannot be used in your code.  x can be any valid variable name

           

          that works great if you have a fixed number of loops. the values can be variables. ex

          bgn=1:en_d=50 

          for x=bgn to en_d

          code

          next x

           

          you can pass this info from your spreadsheet. ex  cell a1 is your begin at number  cell b1 is your end number

          bgn=cells(a1):en_d=cells(b1)

          for x=bgn to en_d

          code

          next x

           

          hope this helps you.  check gasmeterguy blog .

          Thanks, that looks like what I am Looking for

          And Mone! thanks for showing me the reference library