A Macro for copy with selection.. (please help me)

G

Guest

Friends, how I can copy specific a specific row range in other sheets with
conditions special. ie:
copy from:
Sheet1: A B C D
1 W 100 200 300
2 400 500 600
3 700 800 900
4 W 1000 1100 1200
5 1300 1400 1500
.... (I not know how many rows there)

to Sheet2 (ONLY range Ax to Dx when Ax = "W")
A B C D
1 W 100 200 300
2 W 1000 1100 1200
....
Thanks, Iván
 
J

jordanctc

Sub SpecialCopy()
Sheets("Sheet2").Select
Range("A1").Select
Sheets("Sheet1").Select
Range("B1").Select

Do Until ActiveCell = ""
If ActiveCell.Offset(0, -1).Value = "W" Then
ActiveCell.EntireRow.Copy
Sheets("Sheet2").Select
ActiveCell.PasteSpecial
ActiveCell.Offset(1, 0).Select
Sheets("Sheet1").Select
End If
ActiveCell.Offset(1, 0).Select
Loop
End Sub

This should work,
Jorda
 
T

Tom Ogilvy

worksheets("Sheets1").Columns(1).SpecialCells(xlConstants) _
.EntireRow.copy _
Destination:=Worksheets("Sheet2").Range("A1")
 
G

Guest

Jordan, thanks...., this solution is ok. in normal ranges, but I forget
to write that "W" lines are rows from a subtotal process.... In this case
the formula don't work.
What do you think, this row is not real?
Thanks, Ivan
 

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