Hey guys,
I've got the code above, but the problem is that when I copy the cells it's copying the formulas and all the formatting too. How can I tweak it to only copy the values inside?
Thank you.
I've got the code above, but the problem is that when I copy the cells it's copying the formulas and all the formatting too. How can I tweak it to only copy the values inside?
Thank you.
Code:
Sub cpydat()
Dim sh1 As Worksheet, sh2 As Worksheet, lr As Long, rng As Range, c As Range, fLoc As Range, grp As Range
Set sh1 = Sheets(1) 'Edit sheet name
Set sh2 = Sheets(2) 'Edit sheet name
lr = sh1.Cells(Rows.Count, 5).End(xlUp).Row
Set rng = sh1.Range("E2:E" & lr)
For Each c In rng
Set fLoc = sh2.Range("B:B").Find(c.Value, , xlValues)
If Not fLoc Is Nothing Then
Set grp = Union(fLoc.Offset(0, -1), fLoc.Offset(0, 1), fLoc.Offset(0, 2))
grp.Copy c.Offset(0, 3)
End If
Next
End Sub
Last edited: