Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
thanks!
"JLGWhiz" wrote: Sub CopyPaste() Dim sFile As Workbook Set sFile = Workbooks.Open(Application.GetOpenFilename) Dim dFile As Workbook Set dFile = Workbooks.Open(Application.GetOpenFilename) sFile.Activate Sheets("Sheet1").Select Cells.Select Selection.Copy dFile.Activate Sheets("Sheet1").Select Cells.Select ActiveSheet.Paste sFile.Activate Sheets("Sheet2").Select Cells.Select Selection.Copy dFile.Activate Sheets("Sheet2").Select Cells.Select ActiveSheet.Paste End Sub "Curt" wrote in message ... 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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Application.GetOpenFileName | Excel Programming | |||
Application.GetOpenFilename vs Application.Dialogs(xlDialogsOpen) | Excel Programming | |||
Application.GetOpenFilename | Excel Programming | |||
Application.GetOpenFilename | Excel Programming | |||
Application.GetOpenFileName | Excel Programming |