The data to copy has been highlighted in sheet1 with green colour and the pasted data has been highlighted in green colour in sheet2
so i neef the code bcoz my data is big
Conditionaly Copy data from sheet 1 and paste to sheet 2
- agog1
- Thread is marked as Resolved.
-
-
Any doubts?
-
https://filedb.experts-exchange.com/...0/Example.xlsx
Download my excel file for ur reference for making vba code of the same
-
Any doubts? Sir/ Mam
-
Hi agog1,
try thisCode
Display MoreSub ertert() Dim x, i&, nm2$, adr$ Dim r As Range, k& x = Sheets("Sheet1").Range("A1").CurrentRegion.Value With Sheets("Sheet2") For i = 2 To UBound(x) nm2 = x(i, 3): k = 3 Set r = .Columns(1).Find(nm2, LookIn:=xlValues, lookat:=xlWhole) If Not r Is Nothing Then adr = r.Address Do k = k + 1 .Cells(r.Row, Columns.Count).End(xlToLeft)(1, 2).Value = x(i, k) Set r = .Columns(1).FindNext(r) Loop While r.Address <> adr End If Next i End With End Sub
-
-
Thank U so much Nilem this code works
But after deleting Column E, Column F and Column G this code is not working i want code for this also
So plz look into it -
Code
Display MoreSub ertert() Dim x, i&, nm2$, adr$ Dim r As Range, k& x = Sheets("Sheet1").Range("A1").CurrentRegion.Value With Sheets("Sheet2") For i = 2 To UBound(x) nm2 = x(i, 3): k = 3 Set r = .Columns(1).Find(nm2, LookIn:=xlValues, lookat:=xlWhole) If Not r Is Nothing Then adr = r.Address Do k = k + 1: [COLOR=#FF0000]If k > UBound(x, 2) Then Exit Do[/COLOR] .Cells(r.Row, Columns.Count).End(xlToLeft)(1, 2).Value = x(i, k) Set r = .Columns(1).FindNext(r) Loop While r.Address <> adr End If Next i End With End Sub
-
Thnx alot for ur precious time Nilem
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!