Macro for copying and replacing data
Closed
                                    
                        simrob316                    
                                    -
                            Aug 17, 2011 at 10:20 AM
                        
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - Aug 17, 2011 at 11:33 PM
        venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - Aug 17, 2011 at 11:33 PM
        Related:         
- Macro for copying and replacing data
- Tmobile data check - Guide
- Protect pdf from copying - Guide
- Data transmission cable - Guide
- Download facebook data - Guide
- Excel online macro - Guide
1 response
                
        
                    venkat1926
    
        
                    Posts
            
                
            1863
                
                            Registration date
            Sunday June 14, 2009
                            Status
            Contributor
                            Last seen
            August  7, 2021
            
            
                    811
    
    
                    
Aug 17, 2011 at 11:33 PM
    Aug 17, 2011 at 11:33 PM
                        
                    not clear
"replace it with the copied row "
sheet1 is to be replaced by sheet 2 or sheet 2 is to be replaced by sheet1????
try this macro and modify if necessary
            "replace it with the copied row "
sheet1 is to be replaced by sheet 2 or sheet 2 is to be replaced by sheet1????
try this macro and modify if necessary
Sub test()
Dim r As Range, c As Range, r1 As Range, x As String
With Worksheets("sheet1")
Set r = Range(.Range("A2"), .Range("A2").End(xlDown))
For Each c In r
x = c.Value
With Worksheets("sheet2").Columns("A:A")
Set r1 = .Cells.Find(what:=x, lookat:=xlWhole)
If Not r1 Is Nothing Then
r1.EntireRow.Copy
End If
End With
c.PasteSpecial
Next c
End With
End Sub
                
                