Sub Test_GetValues()
Dim fPath As String, fOpen As Variant, wb As Workbook, rng1 As Range, rng2 As Range
fPath = Sheets("[COLOR=#ff0000]SheetXXX[/COLOR]").Range("A2")
[I][COLOR=#006400]'specify default drive and folder for GetOpenFilename[/COLOR][/I]
ChDrive Left(fPath, 1)
ChDir fPath
[I][COLOR=#006400]'get workbook[/COLOR][/I]
fOpen = Application.GetOpenFilename("Excel Files (*.xls*), *.xls*")
If fOpen <> False Then Set wb = Workbooks.Open(fOpen) Else GoTo handling
[COLOR=#006400][I]'get ranges[/I][/COLOR]
With Application
Set rng1 = .InputBox("Select range to pull", "Get data", , , , , , 8)
ThisWorkbook.Activate
Set rng2 = .InputBox("Select paste cell", "Paste where", , , , , , 8)
End With
[COLOR=#006400][I]'copy\paste values & formats[/I][/COLOR]
rng1.Copy
rng2.PasteSpecial (xlPasteFormulasAndNumberFormats)
rng2.PasteSpecial (xlPasteValues)
wb.Close False [I][COLOR=#006400]'close without saving[/COLOR][/I]
Exit Sub
handling:
MsgBox "nothing selected"
End Sub