Copying info from one worksheet to another

O

oscarooko

Hello,
I'm using Excel 2003. I have two worksheets, say WS1 and WS2.
In WS1, I have some columns,and I will need to copy data from thi
worksheet into WS2 wherever the value in "Grade" Column IS NOT "FAIL"

So basically, my macro will copy specific columns from WS1 and past
them into specific columns in WS2 if Column "Grade" in WS1 is NO
"FAIL" for all entries from row 13 in WS1

The info will be pated into WS2 from row 10

Any clues?

Thank
 
M

MattShoreson

have a button which loops thru the grade column, if the cellvalue
evaluates to not fail then populate an array.

When the grade column has been evaluated, goto WS2 and populate with
the array!
 
O

Otto Moehrbach

This macro will do what you say you want. I assumed the Grade column was
Column F. I also assumed that you want Columns A:G copied and pasted to
Columns A:G in WS2 starting in row 10.
As written, the data will be pasted into WS2 starting in the row that is
immediately below the last entry in Column A from A10 down. HTH Otto
Sub CopyData()
Dim RngGrade As Range
Dim i As Range
Dim Dest As Range
With Sheets("WS2")
If IsEmpty(.Range("A10")) Then
Set Dest = .[A10]
Else
Set Dest = .Range("A" & Rows.Count).End(xlUp).Offset(1)
End If
End With
Set RngGrade = Range("F13", Range("F" & Rows.Count).End(xlUp))
For Each i In RngGrade
If i.Value <> "FAIL" Then
Range(Cells(i.Row, 1), Cells(i.Row, 7)).Copy Dest
Set Dest = Dest.Offset(1)
End If
Next i
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top