Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have copied this code pretty much entirely from another post but it
throws up Run time error 9 subscript out of range'. Can anyone help? Thanks Public Sub ImportData() Dim myFilename As Variant Dim importbook As Workbook Dim mainbook As Workbook MsgBox "Please select the Do Not Trace workbook you wish to import." myFilename = Application.GetOpenFilename("Excel Files (*.xls), *.xls") 'launches prompt to select import file Set mainbook = ActiveWorkbook Set importbook = Workbooks.Open(Filename:=myFilename) 'sets variable to be workbook that opens importbook.Worksheets("sheet1").Copy _ befo=mainbook.Worksheets(1) importbook.Close savechanges:=False 'closes the import sheet end sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copy code failing | Excel Programming | |||
Macros failing when workbook is in shared mode | Excel Programming | |||
copy method of object failing | Excel Programming | |||
loop through a column on a workbook copying data on each row to another workbook, then copy data back to the original workbook | Excel Programming | |||
Excel Copy Method Failing. | Excel Programming |