Home Copy specific cells of same row in another worksheet if text found
Reply: 0

Copy specific cells of same row in another worksheet if text found

user5214
1#
user5214 Published in September 20, 2018, 5:18 pm

I need to copy specific cells of a row, to another worksheet in same bock, if determined Text appears in a "H" column. I´m alredy able to copy the entire column, but I´m not able to copy just the cells of the row I really want.

Dim rango As Range
Dim i As Integer
Dim Source As Worksheet
Dim Target As Worksheet

Set Source = ActiveWorkbook.Worksheets("Sumas y Saldos")
Set Target = ActiveWorkbook.Worksheets("Check")

nfil = Source.Range("H9").End(xlDown).Row
i = 9
For Each rango In Source.Range("H8:H" & nfil)
    If rango = "REVISAR" Then
       Source.Rows(rango.Row).Copy Target.Rows(i)
       i = i + 1
    End If
Next rango
'2 second try of the code, this is what I try to do in the If to copy just that cells.
If rango = "REVISAR" Then
Source.Rows(rango.Column).Copy Target.Column(i)
Source.Range("G9:G" & nfil).Copy Destination:=Target.Range("A8:A" & nfil)
Source.Range("H9:H" & nfil).Copy Destination:=Target.Range("B8:B" & nfil)
Source.Range("I9:I" & nfil).Copy Destination:=Target.Range("C8:C" & nfil)
Source.Range("J9:J" & nfil).Copy Destination:=Target.Range("D8:D" & nfil)
Source.Range("K9:K" & nfil).Copy Destination:=Target.Range("E8:E" & nfil)
Source.Rows(rango.Row).Copy Target.Rows(i)
i = i + 1
End If

Hope someone can help me... Thanks

share|improve this question

1 Answer 1

active oldest votes
up vote 0 down vote
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.375906 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO