LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Programming advice please

I have a fair bit of information to swap between two workbooks.
From a utility workbook "Bk-a.xls", I compiled a macro as follow.
Line numbers are added for reference here.
I would appreciate some advice on

why line 70+80 failed (application or obj defined error)
but line 60 is OK

line 90 must be in the form as line 100;

Is there ways to avoid switching windows repeatedly please?

10 Sub t()
20 Dim frmBK As Workbook
30 Dim toBK As Workbook
40 Set frmBK = Workbooks.Open("Bk-b.xls")
50 Set toBK = Workbooks.Open("Bk-c.xls")

60 frmBK.Sheets(1).Range("B1").Copy toBK.Sheets(1).Range("C2")
70 'frmBK.Sheets(1).Range(Range("B1"), Range("B1").End(xlToRight)).Copy _
80 'toBK.Sheets(1).Range("C2")

90 'Windows(frmBK).Activate
100 Windows("bk-b.xls").Activate
110 Range(Range("B1"), Range("B1").End(xlToRight)).Copy
120 'Windows(toBK).Activate
130 Windows("bk-c.xls").Activate
140 Range("C2").PasteSpecial
150 End Sub

Regards
Have a happy New Year
KC


 
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
Need advice Form maker Excel Worksheet Functions 1 December 2nd 06 04:26 PM
Almost got it !! but need advice Nospam Excel Worksheet Functions 6 February 28th 05 10:27 AM
Advice please Greg New Users to Excel 2 February 24th 05 12:19 PM
In need of advice? onedaywhen Excel Programming 6 June 7th 04 02:22 PM
please advice Waleed Hanafy Excel Programming 1 April 15th 04 02:50 PM


All times are GMT +1. The time now is 02:17 PM.

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

About Us

"It's about Microsoft Excel"