Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have this great code that imports worksheets into the active workbook. I
want the imported worksheets to overright the existing worksheets with the same name. The imported and resident worksheets are all of the same name. I don't want the imported worksheet to take the name of Worksheet (2. The reason I'm doing this is because of charts that use the existing referenced worksheets. here is the code I have so far, all works fine except the (2): Sub Import() Dim basebook As Workbook Dim mybook As Workbook Dim N As Long Dim MyPath As String Dim SaveDriveDir As String Dim FName As Variant SaveDriveDir = CurDir MyPath = "C:\Documents and Settings\eberger\My Documents\Employee Survey\ES2009\NewWorkbooks\" ChDrive MyPath ChDir MyPath FName = Application.GetOpenFilename(filefilter:="Excel Files (*.xls), *.xls", _ MultiSelect:=True) If IsArray(FName) Then Application.ScreenUpdating = False Set basebook = ActiveWorkbook For N = LBound(FName) To UBound(FName) Set mybook = Workbooks.Open(FName(N)) mybook.Worksheets.Copy befo= _ basebook.Sheets(basebook.Sheets.Count) mybook.Close False Next End If ChDrive SaveDriveDir ChDir SaveDriveDir Application.ScreenUpdating = True End Sub -- Your guidance is greatly appreciated! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel formula for an "if" "then" scenario linking 3 worksheets | Excel Discussion (Misc queries) | |||
Import data "Hangs", A "time out" is needed. Help! :) | Excel Programming | |||
Why is "History" a "reserved name" while naming Excel worksheets? | Excel Discussion (Misc queries) | |||
Problem: Worksheets("New Style 2006").Unprotect Password:="naPrint" | Excel Programming | |||
use variable in Workbooks("book1").Worksheets("sheet1").Range("a1" | Excel Programming |