C
Christy
I found this code on Ron's site and it is exactly what I need. I was able to
download and run his example just fine but when I put the exact code in my
workbook I get 'Subscript out of range'. I pasted the functions in one
module and the macros in another just like in the example.
I have not even tried to modify the from and to ranges yet. Any help will be
greatly appreciated.
Sub GetData_Example2()
Dim SaveDriveDir As String, MyPath As String
Dim FName As Variant
SaveDriveDir = CurDir
MyPath = Application.DefaultFilePath 'or use "C:\Data"
ChDrive MyPath
ChDir MyPath
FName = Application.GetOpenFilename(filefilter:="Excel Files, *.xls")
If FName = False Then
'do nothing
Else
GetData FName, "Sheet1", "A1:C5", Sheets("Sheet1").Range("A1"), False
End If
ChDrive SaveDriveDir
ChDir SaveDriveDir
End Sub
Christy
download and run his example just fine but when I put the exact code in my
workbook I get 'Subscript out of range'. I pasted the functions in one
module and the macros in another just like in the example.
I have not even tried to modify the from and to ranges yet. Any help will be
greatly appreciated.
Sub GetData_Example2()
Dim SaveDriveDir As String, MyPath As String
Dim FName As Variant
SaveDriveDir = CurDir
MyPath = Application.DefaultFilePath 'or use "C:\Data"
ChDrive MyPath
ChDir MyPath
FName = Application.GetOpenFilename(filefilter:="Excel Files, *.xls")
If FName = False Then
'do nothing
Else
GetData FName, "Sheet1", "A1:C5", Sheets("Sheet1").Range("A1"), False
End If
ChDrive SaveDriveDir
ChDir SaveDriveDir
End Sub
Christy