Current code - I have written a code, in which it will search for a value present in Sheet2 B1 cell, in sheet 1 and copy paste that entire column in "Column C " and "column D".
Required - I want to loop the same thing, once B1 in sheet 2 is executed, check for value in B2 (sheet2), in Sheet1, if found, create a new sheet and paste entire column value in "Column C and D". Loop should run til all the rows in Sheet2 column B and for each value found create new sheet and paste.
please help me loop and edit this code.
Current code
Sub Look_copy()
Dim sh1 As Worksheet, sh2 As Worksheet
Dim K As Long, l As Long, i As Long, nRow As Long
Dim valuee1 As Variant
Set sh1 = Sheets("Sheet1")
Set sh2 = Sheets("Sheet2")
K = 3
l = 4
nRow = 1
valuee1 = Sheet2.Range("B1").Value
For i = 1 To Columns.Count
If sh1.Cells(nRow, i).Value = valuee1 Then
sh1.Cells(nRow, i).EntireColumn.Copy sh2.Cells(1, K)
sh1.Cells(nRow, i + 1).EntireColumn.Copy sh2.Cells(1, l)
K = K + 1
l = l + 1
End If
Next i
End Sub