?
Solved

Combining process to copy cells

Posted on 2013-06-20
2
Medium Priority
?
203 Views
Last Modified: 2013-06-20
Is there a better way to combine the below code to copy cells from one sheet to another?


Sheets("Compare").Select
    Range("C3:C5000").Select
    Selection.Copy
    Sheets("Prices").Select
    Range("A4").Select
    ActiveSheet.Paste
   
    Sheets("Compare").Select
    Range("AJ3:AJ5000").Select
    Selection.Copy
    Sheets("Prices").Select
    Range("B4").Select
    ActiveSheet.Paste

Sheets("Compare").Select
    Range("AP3:AP5000").Select
        Selection.Copy
    Sheets("Prices").Select
    Range("C4").Select
    ActiveSheet.Paste

Sheets("Compare").Select
    Range("AQ3:AQ5000").Select
     Selection.Copy
    Sheets("Prices").Select
    Range("D4").Select
    ActiveSheet.Paste
0
Comment
Question by:leezac
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 39

Accepted Solution

by:
nutsch earned 1260 total points
ID: 39263363
Something like this?

Dim shtCompare As Worksheet, shtPrices As Worksheet

Set shtCompare = Sheets("Compare")
Set shtprice = Sheets("Prices")
    
shtCompare.Range("C3:C5000").Copy Sheets("Prices").Range("A4")
shtCompare.Range("AJ3:AJ5000").Copy Sheets("Prices").Range("B4")
shtCompare.Range("AP3:AP5000").Copy Sheets("Prices").Range("C4")
shtCompare.Range("AQ3:AQ5000").Copy Sheets("Prices").Range("D4")

Open in new window

0
 

Author Comment

by:leezac
ID: 39263588
Yes  - thank you
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question