PDA

View Full Version : Solved: how to copy value with criteria to other worksheet?



henryadam
05-06-2008, 01:17 PM
how to copy value with criteria to other worksheet?

condition:
copy all row from worksheet rawdata to sheet print where col "blt" is not null..

Thanks

Simon Lloyd
05-06-2008, 01:27 PM
You didn't specify where on Print sheet to copy to but try this:

Sub Move_To_Print()
Dim Rng As Range, MyCell As Range
Set Rng = Sheets("RawData").Range("M7:M" & Range("M" & Rows.Count).End(xlUp).Row)
For Each MyCell In Rng
If MyCell <> "" Then
MyCell.EntireRow.Copy Destination:=Sheets("Print").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
End If
Next
End Sub

henryadam
05-06-2008, 08:06 PM
thanks Simon,

i need copy col on rawdata to print template, how insert row at print template when criteria found?

lucas
05-06-2008, 08:58 PM
At which row on the print sheet do you want to start putting data Henry, row 10?

I don't speak your language so I can't tell if the data will line up or is in a different order on the two sheets.

Another possibility, unless you need special formatting when you print might be a filter on the same page as the data is in. Select your data and use autofilter, Filter for non-blanks

One other problem I noticed is that the sheet print has a number of merged cells......I avoid merging cells if I can. It will cause you problems with vba. Use center across selection instead.

henryadam
05-07-2008, 08:16 AM
Thanks Simon, i've fixed this problem .....