Solved

Combining process to copy cells

Posted on 2013-06-20
2
173 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
2 Comments
 
LVL 39

Accepted Solution

by:
nutsch earned 315 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Drop Down List with Unique/Distinct Values (enhancing the Combo-Box with a few steps and a little code) David miller (dlmille) Intro Have you ever created a data validation list from a database field or spreadsheet column (e.g., Zip Codes or Co…
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

863 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now