Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Mike
 
Posts: n/a
Default help with macro please

I'm using the macro below Kindly sent to me by Bob Phillips, to print out
when in press a button in excel, It works great except it resets to zero
before it prints is there a way to get it to print the value in AA2 before it
resets it back to zero

Sub Button2_Click()
With Sheets("Sheet1")
.Range("AB3").Value = _
.Range("AB3").Value + .Range("AA2").Value
.Range("AA2").Value = 0
End With
ActiveSheet.Range("AG3:AH10").PrintOut preview:=False
End Sub

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
davesexcel
 
Posts: n/a
Default help with macro please


Mike Wrote:



.Range("AA2").Value = 0
End With
ActiveSheet.Range("AG3:AH10").PrintOut preview:=False
End Sub

Thanks

Look at the code, do you see it sets to Zero before it prints, can you
think of a way to stop setting it to zero before the print
command??!


--
davesexcel
------------------------------------------------------------------------
davesexcel's Profile: http://www.excelforum.com/member.php...o&userid=31708
View this thread: http://www.excelforum.com/showthread...hreadid=516654

  #3   Report Post  
Posted to microsoft.public.excel.misc
Paul B
 
Posts: n/a
Default help with macro please

Mike, try this,

Sub Button2_Click()
With Sheets("Sheet1")
.Range("AB3").Value = _
.Range("AB3").Value + .Range("AA2").Value
ActiveSheet.Range("AG3:AH10").PrintOut preview:=False
.Range("AA2").Value = 0
End With

End Sub


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"Mike" wrote in message
...
I'm using the macro below Kindly sent to me by Bob Phillips, to print out
when in press a button in excel, It works great except it resets to zero
before it prints is there a way to get it to print the value in AA2 before

it
resets it back to zero

Sub Button2_Click()
With Sheets("Sheet1")
.Range("AB3").Value = _
.Range("AB3").Value + .Range("AA2").Value
.Range("AA2").Value = 0
End With
ActiveSheet.Range("AG3:AH10").PrintOut preview:=False
End Sub

Thanks



  #4   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student
 
Posts: n/a
Default help with macro please

Try to move the reset to zero after the print:



Sub Button2_Click()
With Sheets("Sheet1")
.Range("AB3").Value = _
.Range("AB3").Value + .Range("AA2").Value
End With
ActiveSheet.Range("AG3:AH10").PrintOut preview:=False
Sheets("Sheet1").Range("AA2").Value = 0
End Sub
--
Gary''s Student


"Mike" wrote:

I'm using the macro below Kindly sent to me by Bob Phillips, to print out
when in press a button in excel, It works great except it resets to zero
before it prints is there a way to get it to print the value in AA2 before it
resets it back to zero

Sub Button2_Click()
With Sheets("Sheet1")
.Range("AB3").Value = _
.Range("AB3").Value + .Range("AA2").Value
.Range("AA2").Value = 0
End With
ActiveSheet.Range("AG3:AH10").PrintOut preview:=False
End Sub

Thanks

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
Search, Copy, Paste Macro in Excel [email protected] Excel Worksheet Functions 0 January 3rd 06 06:51 PM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
macro with F9 Kenny Excel Discussion (Misc queries) 1 August 3rd 05 02:41 PM
Make Alignment options under format cells available as shortcut dforrest Excel Discussion (Misc queries) 1 July 14th 05 10:58 PM
Playing a macro from another workbook Jim Excel Discussion (Misc queries) 1 February 23rd 05 10:12 PM


All times are GMT +1. The time now is 03:10 PM.

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"