Solved

VBA Copy Range

Posted on 2014-02-05
2
216 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
[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 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

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

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

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

691 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