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: 469
Default Help with activating window from Application.GetOpenFilename

I am new to VBA and I have spent hours trying to solve the following macro.

Currently, this code works how I want it except I would like to change the
of the file names of "Book1.xls" and "Book2.xls" to file paths for variables
"sFile1" and "dFile".

For example, if I selected "Book4.xls" and "Book5.xls", I would like the
activewindow to be reflected these file paths instead.

thanks for any help!

Curt J

Sub CopyPaste()

Dim sFile As Workbook
Set sFile = Workbooks.Open(Application.GetOpenFilename)


Dim dFile As Workbook
Set dFile = Workbooks.Open(Application.GetOpenFilename)

Windows("Book1.xls").Activate
Sheets("Sheet1").Select
Cells.Select
Selection.Copy

Windows("Book2.xls").Activate
Sheets("Sheet1").Select
Cells.Select
ActiveSheet.Paste

Windows("Book1.xls").Activate
Sheets("Sheet2").Select
Cells.Select
Selection.Copy

Windows("Book2.xls").Activate
Sheets("Sheet2").Select
Cells.Select
ActiveSheet.Paste


End Sub
 
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
Application.GetOpenFileName Chris Excel Programming 7 August 19th 06 12:37 AM
Application.GetOpenFilename vs Application.Dialogs(xlDialogsOpen) Paul Martin Excel Programming 5 August 5th 05 04:44 PM
Application.GetOpenFilename Greg[_19_] Excel Programming 3 February 20th 05 01:55 AM
Application.GetOpenFilename Philipp Oberleitner[_2_] Excel Programming 2 July 9th 04 07:29 PM
Application.GetOpenFileName ptrowe Excel Programming 2 September 11th 03 12:54 PM


All times are GMT +1. The time now is 10:42 AM.

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"