Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default ADD 1 TO CELL UPON PRINT

I tried from the sheet where the cell is to be changed.
I selected Tools Macro Macros and chose PrintCopies.
I also tried from VBA while the macro was visible by
selecting Run Run Sub/UserForm

Thank you.
-----Original Message-----
Sandra,

How are you running the macro, and what is the current

selection when you do
it? Did you assign the macro to a button on the sheet,

do you have a graph
selected, etc....

HTH,
Bernie
MS Excel MVP

"Sandra" wrote in

message
...
Bernie, I copied and pasted the code. When I tried to

run
the macro, I received this message: "Compile error:
Invalid Outside Procedure" ????

Thanks
Sandra
-----Original Message-----
Sandra,

Instead of using the before print method, your could

use
a little macro:

Sub PrintCopies()
Dim i As Integer
Dim iCopies As Integer
iCopies = Application.InputBox("How many copies?")
For i = 1 To iCopies
Range("A1").Value = Range("A1").Value + 1
ActiveSheet.PrintOut
Next i
End Sub

HTH,
Bernie
MS Excel MVP

"Sandra" wrote

in
message
...
Bernie, this works great! What does "Cancel As

Boolean"
mean?

Now, can you tell me how to have the program ask me

how
many copies, accept my answer and print that many?

I
think I know how to "call" the code below within the

code
I just requested.

Thanks.

-----Original Message-----
Sandra,

You could use the Before_Print event:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Range("A1").Value = Range("A1").Value + 1
End Sub

Change the A1 to the cell of interest.

Or you could use a macro to print multiple copies,
incrementing the cell
each time through the loop.

HTH,
Bernie
MS Excel MVP

"Sandra"

wrote
in
message
...
I have a cell in a worksheet that I want to add

1 to
each
time the page is printed.
For example 4300 this time, 4301 next time, 4302

next.
I know this is easy in programming, but I don't

know
where to start in Excel.


.



.



.

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
Cell borders do not print on one side of print area?? alan82 Excel Discussion (Misc queries) 4 May 3rd 23 07:42 PM
cell borders that I create dont show on print preview or print scott3435 Excel Discussion (Misc queries) 2 April 6th 06 02:37 AM
Active cell counting in particular print page (one sheet having different print area) ananthmca2004 Excel Worksheet Functions 1 November 24th 05 11:29 AM
Excel cell looks good in print preview but doesn't print??? Jack Gathright Excel Discussion (Misc queries) 1 September 13th 05 12:38 PM
One spreadsheet cell won't print but shows up in print preview? Sally Excel Discussion (Misc queries) 1 May 26th 05 07:06 PM


All times are GMT +1. The time now is 11:02 AM.

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

About Us

"It's about Microsoft Excel"