Solved

How to Copy range in another workbook to present position in active workbook

Posted on 2013-01-03
4
292 Views
Last Modified: 2013-01-03
I have a workbook, Book1,  with a range of cells which I want to copy to the active workbook, Book2, in the present position.
Both workbooks are open, but Book2 is active and the active cell is already determined by VBA.
I prefer that the focus does not shift to the source workbook, but only refer to the range in that workbook.
I want to use VBA. Can you help with the code please.
0
Comment
Question by:Fritz Paul
  • 2
4 Comments
 
LVL 29

Expert Comment

by:gowflow
ID: 38739284
What do you mean by 'present position' ??
gowflow
0
 
LVL 29

Expert Comment

by:gowflow
ID: 38739292
if WS1 is workbook1 Sheet1 and WS2 is workbook2 Sheet1 or any sheet then to copy say range A1:B6 in Book1 then

WS1.range("A1:B6").copy WS2.activecell

will copy the Range A!:B6 fm Book1 to the Activecell in Book2

gowflow
0
 
LVL 48

Accepted Solution

by:
jpaulino earned 500 total points
ID: 38739294
You could do something like this:

Dim rngSource As Range
Set rngSource = Workbooks("SourceBook").Worksheets("Sheet1").Range("a1:a10")
rngSource.Copy ActiveCell

Open in new window

0
 

Author Closing Comment

by:Fritz Paul
ID: 38739791
Thanks!
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

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 article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
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…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

914 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

13 Experts available now in Live!

Get 1:1 Help Now