Solved

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

Posted on 2013-01-03
4
291 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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 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 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 in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

705 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

19 Experts available now in Live!

Get 1:1 Help Now