View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
jermsalerms[_4_] jermsalerms[_4_] is offline
external usenet poster
 
Posts: 1
Default Macro to import from one closed workbook


This is what I have entered into Visual Basic...when I run the macro
get error 400


Sub X()
srcpath = "C:\Documents and Settings\user\M
Documents\Spreadsheets\Data"
srcbook = "InfoUSA List.xls"
srcsheet = "mor01001"
srcrng = "a2:g4001"

With Sheet1.Range(srcrng) 'correct variable and add to with statemen
so it applies to copy and pastespec methods as well
.FormulaArray = "='" & srcpath & "\[" & srcbook & "]" & srcsheet & "'!
& srcrng
.Copy
.PasteSpecial xlPasteValues
End With
Application.CutCopyMode = False

End Su

--
jermsalerm
-----------------------------------------------------------------------
jermsalerms's Profile: http://www.excelforum.com/member.php...fo&userid=3016
View this thread: http://www.excelforum.com/showthread.php?threadid=49854