+ Reply to Thread
Results 1 to 3 of 3

Macro Help Please

  1. #1
    Registered User
    Join Date
    09-21-2005
    Posts
    1

    Macro Help Please

    I need to create a macro that will take a value in cell A1 and add 1 to it, and put the new value back into cell A1, then print the page. It should then add 1 to cell A1 again, putting the new value back into cell A1 and print again. It should repeat this process untill cell A1 reaches a certain value and then stop.

    Any help at all would be very appreciated.
    thank you

  2. #2
    TomHinkle
    Guest

    RE: Macro Help Please

    Record a macro where you select A1, add 1 to it, then print the page.

    That is the meat of the macro.

    Around that you will have to use a loop. The easiest for a beginner is
    probably a For...Next loop

    Basically in your macro add this line AFTER the line that says PUBLIC Macro1()
    but before any of the other commmands:

    For I = 1 to 100 (or however many you want to go)


    Then add the following line right before the line that says END SUB

    Next


    If not, look up a for next loop



    "jespl1" wrote:

    >
    > I need to create a macro that will take a value in cell A1 and add 1 to
    > it, and put the new value back into cell A1, then print the page. It
    > should then add 1 to cell A1 again, putting the new value back into
    > cell A1 and print again. It should repeat this process untill cell A1
    > reaches a certain value and then stop.
    >
    > Any help at all would be very appreciated.
    > thank you
    >
    >
    > --
    > jespl1
    > ------------------------------------------------------------------------
    > jespl1's Profile: http://www.excelforum.com/member.php...o&userid=27451
    > View this thread: http://www.excelforum.com/showthread...hreadid=469610
    >
    >


  3. #3
    Jim Thomlinson
    Guest

    RE: Macro Help Please

    Sub IncrementAndPrint()
    Dim lngCounter As Long
    Dim wks As Worksheet

    Set wks = ActiveSheet
    For lngCounter = 1 To 5
    wks.Range("A1") = wks.Range("A1") + 1
    wks.PrintPreview 'Change to wks.Printout
    Next lngCounter
    End Sub
    --
    HTH...

    Jim Thomlinson


    "jespl1" wrote:

    >
    > I need to create a macro that will take a value in cell A1 and add 1 to
    > it, and put the new value back into cell A1, then print the page. It
    > should then add 1 to cell A1 again, putting the new value back into
    > cell A1 and print again. It should repeat this process untill cell A1
    > reaches a certain value and then stop.
    >
    > Any help at all would be very appreciated.
    > thank you
    >
    >
    > --
    > jespl1
    > ------------------------------------------------------------------------
    > jespl1's Profile: http://www.excelforum.com/member.php...o&userid=27451
    > View this thread: http://www.excelforum.com/showthread...hreadid=469610
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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