Search for specific text & copy Row+next Row
Closed
                                    
                        Naim                    
                                    -
                            Jun  5, 2012 at 09:33 AM
                        
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - Jun 6, 2012 at 03:18 AM
        venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - Jun 6, 2012 at 03:18 AM
        Related:         
- Search for specific text & copy Row+next Row
- Saints row 2 cheats - Guide
- How to search for a specific word on a webpage - Guide
- How to delete a row in word - Guide
- How do i find a specific video on youtube - Guide
- Vb net find last row in excel sheet - Guide
1 response
                
        
                    venkat1926
    
        
                    Posts
            
                
            1863
                
                            Registration date
            Sunday June 14, 2009
                            Status
            Contributor
                            Last seen
            August  7, 2021
            
            
                    811
    
    
                    
Jun 6, 2012 at 03:18 AM
    Jun 6, 2012 at 03:18 AM
                        
                    there is a gradeA in macro. where doe this come in 
when you enter preferably do not enter spaces before or after
for example it looks while copying your data the cell values for e.g
test00<space>
such leading and following spaces should be avoided in entering cells.
see the modified macro (this will loop)
            when you enter preferably do not enter spaces before or after
for example it looks while copying your data the cell values for e.g
test00<space>
such leading and following spaces should be avoided in entering cells.
see the modified macro (this will loop)
Sub testme()
Dim FoundCell As Range
Dim add As String
With Worksheets("Sheet1")
Set FoundCell = .Cells.Find(What:="*test00*", lookat:=xlWhole)
If FoundCell Is Nothing Then
MsgBox "Not found"
Else
add = FoundCell.Address
FoundCell.Resize(2, 1).EntireRow.Copy
        Sheet2.Range("A1").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
End If
Do
Set FoundCell = .Cells.FindNext(FoundCell)
If FoundCell Is Nothing Then Exit Do
If FoundCell.Address = add Then Exit Do
FoundCell.Resize(2, 1).EntireRow.Copy
        Sheet2.Range("A1").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
Loop
End With
End Sub
                
                