Solved

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

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

738 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