Find and copy the data




Sub CLE()
'ONEYEAR DATA
Sheets("Sheet2").Select
'Range("j10: L110 ").ClearContents
'FSTR = InputBox("Enter the date.. You wanted to See !")

lastrow = Sheets("sheet2").UsedRange.Rows.Count
On Error GoTo sant
For I = 6 To lastrow
If Range("C" & I) <> "" Then
fstr = Sheets("sheet2").Range("c" & I).Value
Sheets("Sheet1").Select
            Cells.Find(What:=fstr, After:=ActiveCell, _
            LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, _
            SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False).Activate
       
    'ActiveCell.CurrentRegion.Select
A = ActiveCell.Row
'MsgBox A + 2
A = A + 2
Range("f" & A).Select
    Selection.Copy
    Sheets("Sheet2").Select
    Range("e" & I).Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    ActiveWorkbook.Save
    'Range("L11") = fstr
sant:
    End If
    Sheets("sheet2").Select
    Next
   
   
End Sub

Comments

Popular posts from this blog

number format

send Mail by outlook from excel sheet