View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Hummel Hummel is offline
external usenet poster
 
Posts: 1
Default VBA Code to copy a worksheet to another Excel Workbook

I am a newbie in VBA and need your help.

I want to do the following from an open Workbook (Destination).

1. Open an Excel Workbook (Source) somewhere on my hard drive - name
of path and file name varies from user to user. Therefore code must
allow user to choose (variable)

2. copy contents of a specific worksheet (Tab name known) to the
active open Workbook (Destination)

The code I have started with this code - (please don't laugh) - but
it lets a lot to be desired.

myFile = Application.GetOpenFilename("All Files,(*.*),*.*")

Workbooks.Open Filename:=myFile
Sheets("Consolidated").Select
Cells.Select
Selection.Copy


I do not know how to bring it into the destination workbook and
specific sheet.

3. Once the cells are copied to the Worksheet, I then want the Soruce
Wprkbook to be closed


Looking forward to your help