Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default conditional copy macro

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.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default conditional copy macro

On May 30, 2:37 pm, Robert Kettle
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
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
Conditional Copy Macro WBTKbeezy Excel Programming 5 April 17th 08 08:00 PM
Conditional copy Idaho Excel User Excel Discussion (Misc queries) 0 August 22nd 06 05:32 PM
Conditional Copy Macro Help Needed [email protected] Excel Programming 1 June 8th 06 09:58 PM
Conditional Copy Paste Macro WH Excel Discussion (Misc queries) 1 March 17th 06 11:02 PM
Conditional Copy pambear Excel Programming 2 April 8th 04 12:56 AM


All times are GMT +1. The time now is 09:49 PM.

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"