ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro Help Please (https://www.excelbanter.com/excel-programming/340739-macro-help-please.html)

jespl1

Macro Help Please
 

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

Any help at all would be very appreciated.
thank yo

--
jespl
-----------------------------------------------------------------------
jespl1's Profile: http://www.excelforum.com/member.php...fo&userid=2745
View this thread: http://www.excelforum.com/showthread.php?threadid=46961


TomHinkle

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



Jim Thomlinson[_4_]

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




All times are GMT +1. The time now is 06:34 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com