PC Review


Reply
Thread Tools Rate Thread

conditional copy macro

 
 
Robert Kettle
Guest
Posts: n/a
 
      30th May 2008
I am looking to set up a macro that will conditionally copy multiple cells
from one worksheet to another and print after each.

Example.

There are two worksheets DATA and REPORT.

For each occurence of TRUE in column A on the DATA worksheet, I want to copy
the corresponding value of column B to REPORT cell H2 (ie. A3=TRUE, copy B3 :
A10=TRUE, copy B10), then print the REPORT worksheet and repeat until all
TRUE rows from DATA have been printed.

Thanks for your help.

 
Reply With Quote
 
 
 
 
Chris
Guest
Posts: n/a
 
      30th May 2008
On May 30, 2:37 pm, Robert Kettle
<RobertKet...@discussions.microsoft.com> wrote:
> I am looking to set up a macro that will conditionally copy multiple cells
> from one worksheet to another and print after each.
>
> Example.
>
> There are two worksheets DATA and REPORT.
>
> For each occurence of TRUE in column A on the DATA worksheet, I want to copy
> the corresponding value of column B to REPORT cell H2 (ie. A3=TRUE, copy B3 :
> A10=TRUE, copy B10), then print the REPORT worksheet and repeat until all
> TRUE rows from DATA have been printed.
>
> Thanks for your help.


Robert,

Try this:

Sub ReportPrint()

Application.ScreenUpdating = False
'x = row number
x = 1

'Loop until reach blank cell in column A
Do Until Cells(x, 1).Value = ""
'Copy cell to Report sheet if True in column A
If Cells(x, 1).Value = True Then
Cells(x, 2).Select
Selection.Copy
Sheets("Report").Select
Range("H2").Select
ActiveSheet.Paste
Application.CutCopyMode = False

'Print report sheet
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Data").Select

End If
x = x + 1
Loop

Application.ScreenUpdating = True
End Sub



Good Luck!
Chris
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to copy and paste values (columns)I have a macro file built C02C04 Microsoft Excel Programming 2 2nd May 2008 01:51 PM
Conditional Copy Macro WBTKbeezy Microsoft Excel Programming 5 17th Apr 2008 08:00 PM
Conditional Copy Macro Help Needed ipsy9@comcast.net Microsoft Excel Programming 1 8th Jun 2006 09:58 PM
Conditional Copy Paste Macro =?Utf-8?B?V0g=?= Microsoft Excel Misc 1 17th Mar 2006 11:02 PM
how to count/sum by function/macro to get the number of record to do copy/paste in macro tango Microsoft Excel Programming 1 15th Oct 2004 01:16 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:32 AM.