You are here:

Excel/moving data - Excel 2010


QUESTION: Running Excel 2010.

I have a spreadsheet (Sheet 1) which has multiple sections. In each section, the rows have drop down lists to select materials, and when selected, the adjacent columns automatically fill in the cost when a quantity is entered.

Each section has between 4-10 rows with 5 columns in each row. Sometimes all rows will be selected and other times perhaps only one. This will leave empty rows and columns.

I need to gather all the materials that have been selected from the various sections and place them in Sheet 2. Starting with the first section, all the data (material, quantity, price) needs to be moved to the Sheet 2. Then, the data selected in the second section needs to be moved and place in the row immediately after the end of the first data moved. No empty rows.

I need this to automatically update/change if the information on Sheet 1 is modified.

This is needed to create a single “pick list” of materials and costs, consolidated onto a single Sheet.

Hope you can help me.

ANSWER: Right-click the sheet tab, paste in this code:
Private Sub Worksheet_Change(ByVal Target As Range)
   On Error Resume Next
   Set curr = Selection
   Application.ScreenUpdating = False
   Application.CutCopyMode = xlCopy
   Application.ScreenUpdating = True
End Sub

That's all.

---------- FOLLOW-UP ----------

QUESTION: Thanks for reply. It appears simple but I don't speak Greek. :) Is it possible to have an explanation of how I apply this. Where would I enter the ranges of cells that would be copied? I guess I'm not sure where the variables are in this code or how it would be executed. Thanks again.

It runs automatically whenever anything on the sheet changes. There's nothing else to do aside from Right-click the sheet tab, select View Code, paste in the code.
It automatically copies every set of contiguous ranges. For example, if you have data in A1:E5 and A12:E19, when you make ANY change, both those ranges will be copied and pasted as one block onto sheet2, taking up A1:E13.
Try it; you'll like it.
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


Bob Umlas


I`m a Microsoft Excel MVP (Most Valuable Professional) and have been since the inception of the program in 1995. I can answer every kind of Excel question except: API, Importing/exporting to other programs (powerpoint, word,...) Also check out my in-person training link at


Worked with MS Excel since version 0.99 (on the Mac!). Was contributing editor to Excellence Magazine, having written >300 articles. John Walkenbach said of me "I finally met someone who knows as much about Excel as I do."

Excellence, The Expert, Microsoft

BA in math, Hofstra University, 1965

Awards and Honors
Led sessions for the Convergence 2004-2006 seminar on Excel tips & tricks

©2016 All rights reserved.