Copy cells to different sheet if value found
Hi,
Am Wed, 24 Apr 2013 20:45:20 +0100 schrieb F:
I need to search through column B and find the first cell holding ',1,'
and then copy the adjacent cell in column C to column D in worksheet
'two'. The search then needs to continue to find the next occurrence of
',1,' in B and copy the corresponding cell in column C to the next row
in column D of worksheet 'two'.
try (modify to suit):
Sub myCopy()
Dim LRow As Long
Dim rngC As Range
Dim i As Long
i = 2
With Sheets("Sheet1")
LRow = .Cells(.Rows.Count, "B").End(xlUp).Row
For Each rngC In .Range("B2:B" & LRow)
If InStr(rngC, ",1,") 0 Then
Sheets("Sheet2").Cells(i, 4) = rngC.Offset(0, 1)
i = i + 1
End If
Next
End With
End Sub
Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
|