Solved

Combining process to copy cells

Posted on 2013-06-20
2
158 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
Comment Utility
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
Comment Utility
Yes  - thank you
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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 …
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

771 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

11 Experts available now in Live!

Get 1:1 Help Now