You are here:

Excel/Lookup Copy and Paste


Hi Jan

Me again, it's just in reference to your previous answer (, the macro worked well only problem is I've found I need it to clear the whole row before copying onto on the mastersheet. Because if the data thats copied is a smaller range that whats on the mastersheet it will leave the remaining codes.

Also is a way of reversing the macro so the copy and pasting goes in the other direction (from Master sheet to Editing sheet)

Hi Ben,

Sure. See if this does the trick:

Sub CopyInfo()
   Dim oCell As Range
   Dim oTarget As Range

   For Each oCell In Worksheets("Master sheet").Range("A2:A12")
       If Len(oCell.Value) > 0 Then
         Set oTarget = Nothing
         Set oTarget = Worksheets("Editing Sheet").UsedRange.Rows(8).Find(oCell.Value)
         If Not oTarget Is Nothing Then
         If Application.CountA(oCell.EntireColumn) > 1 Then
         oCell.Offset(5).Resize(Application.CountA(oCell.EntireRow) - 5).Copy
         oTarget.Offset(3).PasteSpecial xlValues, , , True
         End If
         End If
       End If
End Sub
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here


All Answers

Answers by Expert:

Ask Experts


Jan Karel Pieterse


Excel and Excel/VBA questions


Excel MVP

Self employed Excel developer

Bachelor in Chemical Engineering

Awards and Honors
Microsoft MVP award since 2002

Past/Present Clients
Shell, Fortis bank, ABN-AMRO bank, Morgan Stanley, ...

©2016 All rights reserved.