wanted to prompt the user to point to the file...
used this...
Public Sub fileopener()
Dim myFileName As Variant
Dim SourceWkbk As Workbook
Dim CurrentWkbk As Workbook
Dim testWks As Worksheet
Dim DestCell As Range
myFileName = Application.GetOpenFilename("Excel files,*.xls")
If myFileName = False Then
Exit Sub 'user hit cancel
End If
Set CurrentWkbk = ActiveWorkbook
Set SourceWkbk = Workbooks.Open(Filename:=myFileName)
Set testWks = Nothing
On Error Resume Next
Set testWks = SourceWkbk.Worksheets("sheet1")
On Error GoTo 0
If testWks Is Nothing Then
MsgBox "Missing the worksheet!"
Else
With CurrentWkbk.Worksheets("Test")
Set DestCell = .Cells(.Rows.Count, "a").End(xlUp).Offset(1, 0)
End With
With testWks
'choose one of these
.Range("a1", .Cells.SpecialCells(xlCellTypeLastCell)).Copy
DestCell.PasteSpecial Paste:=xlPasteAll
Application.CutCopyMode = False
End With
End If
SourceWkbk.Close savechanges:=False
End Sub
does the trick... think it must just have been a 'brain phart' :-) as i've not done any coding 'in anger' for a while...