Solved

VBA Copy Range

Posted on 2014-02-05
2
205 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
ID: 39836986
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
ID: 39836999
Thank you Matt just what I was looking for.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

828 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