Solved

VBA Copy Range

Posted on 2014-02-05
2
197 Views
Last Modified: 2014-02-05
Hi,
Could I please get assistance would like to update the range so that if the file is updated and goes paste 1321 the data is captured?

Here is my code so far:

Set wbPaste = ActiveWorkbook
    Set wbCopy = Workbooks.Open("\Phased.XLS")
    Set wsCopy = wbCopy.Worksheets("SS")
    Set rngCopy = wsCopy.Range("A5:HX1321")
     
    Set wsPaste = wbPaste.Worksheets("DataSheet")
    Set rngPaste = wsPaste.Range("a4")
    

Open in new window

0
Comment
Question by:jmac001
2 Comments
 
LVL 35

Accepted Solution

by:
mvidas earned 500 total points
Comment Utility
Just change the "set rngcopy" line as follows, should do the trick:
'    Set rngCopy = wsCopy.Range("A5:HX1321")
    Set rngCopy = Intersect(wsCopy.Range("A5:HX" & wsCopy.Rows.Count), wsCopy.UsedRange.EntireRow)

Open in new window

Matt
0
 

Author Closing Comment

by:jmac001
Comment Utility
Thank you Matt just what I was looking for.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

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

10 Experts available now in Live!

Get 1:1 Help Now