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(quot;Sheet1quot;)
.Range(quot;AB3quot;).Value = _
.Range(quot;AB3quot;).Value .Range(quot;AA2quot;).Value
.Range(quot;AA2quot;).Value = 0
End With
ActiveSheet.Range(quot;AG3:AH10quot;).PrintOut preview:=False
End Sub
Thanks
Mike Wrote:
gt;
gt;
gt;
gt; .Range(quot;AA2quot;).Value = 0
gt; End With
gt; ActiveSheet.Range(quot;AG3:AH10quot;).PrintOut preview:=False
gt; End Sub
gt;
gt; 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: www.excelforum.com/member.php...oamp;userid=31708
View this thread: www.excelforum.com/showthread...hreadid=516654Mike, try this,
Sub Button2_Click()
With Sheets(quot;Sheet1quot;)
.Range(quot;AB3quot;).Value = _
.Range(quot;AB3quot;).Value .Range(quot;AA2quot;).Value
ActiveSheet.Range(quot;AG3:AH10quot;).PrintOut preview:=False
.Range(quot;AA2quot;).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 amp; 2003
quot;Mikequot; gt; wrote in message
...
gt; I'm using the macro below Kindly sent to me by Bob Phillips, to print out
gt; when in press a button in excel, It works great except it resets to zero
gt; before it prints is there a way to get it to print the value in AA2 before
it
gt; resets it back to zero
gt;
gt; Sub Button2_Click()
gt; With Sheets(quot;Sheet1quot;)
gt; .Range(quot;AB3quot;).Value = _
gt; .Range(quot;AB3quot;).Value .Range(quot;AA2quot;).Value
gt; .Range(quot;AA2quot;).Value = 0
gt; End With
gt; ActiveSheet.Range(quot;AG3:AH10quot;).PrintOut preview:=False
gt; End Sub
gt;
gt; Thanks
Try to move the reset to zero after the print:
Sub Button2_Click()
With Sheets(quot;Sheet1quot;)
.Range(quot;AB3quot;).Value = _
.Range(quot;AB3quot;).Value .Range(quot;AA2quot;).Value
End With
ActiveSheet.Range(quot;AG3:AH10quot;).PrintOut preview:=False
Sheets(quot;Sheet1quot;).Range(quot;AA2quot;).Value = 0
End Sub
--
Gary''s Studentquot;Mikequot; wrote:
gt; I'm using the macro below Kindly sent to me by Bob Phillips, to print out
gt; when in press a button in excel, It works great except it resets to zero
gt; before it prints is there a way to get it to print the value in AA2 before it
gt; resets it back to zero
gt;
gt; Sub Button2_Click()
gt; With Sheets(quot;Sheet1quot;)
gt; .Range(quot;AB3quot;).Value = _
gt; .Range(quot;AB3quot;).Value .Range(quot;AA2quot;).Value
gt; .Range(quot;AA2quot;).Value = 0
gt; End With
gt; ActiveSheet.Range(quot;AG3:AH10quot;).PrintOut preview:=False
gt; End Sub
gt;
gt; Thanks
- Jun 22 Fri 2007 20:38
help with macro please
close
全站熱搜
留言列表
發表留言