Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 273
Default Help in Pasting from 1 workbook to another in code

I am using VBA code in Access to paste 1 column from workbook 1 to workbook 2.

This is the code that works by itself:

xlApp.Workbooks.Open(pathS).Worksheets("an_fb_diff ").Range("A2:A237").Copy
destination:=xlApp.Workbooks.Open(path).Worksheets ("an_fb").Range("A3")

I am unable to following it by another one because I am using the Open. I
wish to repeat the pasting from a different worksheet.

Can someone help me in indicating what I should replace the Open with????

I tried:

xlApp.Workbooks(pathS).Worksheets("cntl_fb_diff"). Range("A2:A110").Copy
destination:=xlApp.Workbooks(path).Worksheets("cnt l_fb").Range("A3")

The above gives me an error!!!

Help is deeply appreciated!!!


Gary
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Help in Pasting from 1 workbook to another in code

dim wb as object, wb2 as object

set wb=xlApp.Workbooks.Open(path1)
set wb2=xlApp.Workbooks.Open(path2)

wb1.Worksheets("an_fb_diff").Range("A2:A237").Copy _
destination:=wb2.Worksheets("an_fb").Range("A3")

Tim



"Gary" wrote in message
...
I am using VBA code in Access to paste 1 column from workbook 1 to workbook
2.

This is the code that works by itself:

xlApp.Workbooks.Open(pathS).Worksheets("an_fb_diff ").Range("A2:A237").Copy
destination:=xlApp.Workbooks.Open(path).Worksheets ("an_fb").Range("A3")

I am unable to following it by another one because I am using the Open. I
wish to repeat the pasting from a different worksheet.

Can someone help me in indicating what I should replace the Open with????

I tried:

xlApp.Workbooks(pathS).Worksheets("cntl_fb_diff"). Range("A2:A110").Copy
destination:=xlApp.Workbooks(path).Worksheets("cnt l_fb").Range("A3")

The above gives me an error!!!

Help is deeply appreciated!!!


Gary



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Help in Pasting from 1 workbook to another in code

Someone out there smarter than me probably has a better way...

could you try something like

ActiveWindow.ActivateNext

this is realy assuming you have only two workbooks open, and it's simlpy the
vba code for Ctrl-F6, which just toggles to the next open workbook....if you
only have two open, use this a few times to toggle back and forth where
needed...


"Gary" wrote in message
...
I am using VBA code in Access to paste 1 column from workbook 1 to workbook
2.

This is the code that works by itself:

xlApp.Workbooks.Open(pathS).Worksheets("an_fb_diff ").Range("A2:A237").Copy
destination:=xlApp.Workbooks.Open(path).Worksheets ("an_fb").Range("A3")

I am unable to following it by another one because I am using the Open. I
wish to repeat the pasting from a different worksheet.

Can someone help me in indicating what I should replace the Open with????

I tried:

xlApp.Workbooks(pathS).Worksheets("cntl_fb_diff"). Range("A2:A110").Copy
destination:=xlApp.Workbooks(path).Worksheets("cnt l_fb").Range("A3")

The above gives me an error!!!

Help is deeply appreciated!!!


Gary



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why can't I use SUM when pasting HTML code into new sheet. Crosscatch Excel Worksheet Functions 1 January 9th 06 04:29 PM
Error in Code - Pasting Values Janet H[_2_] Excel Programming 5 September 1st 05 09:35 PM
Pasting from a specific Workbook to another workbook without having to name it. Sue[_6_] Excel Programming 1 September 18th 04 06:48 PM
Over-Eager code is pasting 3 times Stuart[_5_] Excel Programming 3 September 10th 03 07:30 PM


All times are GMT +1. The time now is 11:31 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"