Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default 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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro recorded... tabs & file names changed, macro hangs Steve Excel Worksheet Functions 3 October 30th 09 11:41 AM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
how to count/sum by function/macro to get the number of record to do copy/paste in macro tango Excel Programming 1 October 15th 04 01:16 PM
macro to delete entire rows when column A is blank ...a quick macro vikram Excel Programming 4 May 3rd 04 08:45 PM
Start Macro / Stop Macro / Restart Macro Pete[_13_] Excel Programming 2 November 21st 03 05:04 PM


All times are GMT +1. The time now is 07:58 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"