View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
FSt1 FSt1 is offline
external usenet poster
 
Posts: 3,942
Default Copy A1:A13 from different workbook

hi,
Somethink like this might work for you. you would have to change the file
path your own file path.

Sub MacCopyStuff()
Dim fnam As String
fnam = InputBox("enter a file name")
Workbooks.Open Filename:= _
"C:\Documents and Settings\Owner\My Documents\" _
& fnam & ".xls"
'use your own file pathe
Sheets("sheet2").Activate
Range("A1:A13").Copy
Windows("yourfilename").Activate 'file name of the file that has this
macro
Sheets("Sheet3").Activate
Range("B1").PasteSpecial xlPasteAll
Windows(fnam).Activate
ActiveWindow.Close
End Sub
regards
FSt1
"ccl28" wrote:


Hi,

I have a workbook name apple.xls that required user to key in the
filename that they used. I do not know how many file the user will key
in.
Example filename they used: 1) a.xls 2) c.xls 3) q.xls 4) z.xls

Based on the filename, I would like to copy the value in the filename
of sheet 2 of A1:A13 into the apple.xls sheet 3 of B1:B13.

How to write a macro that can do this function?

Thank you.


--
ccl28
------------------------------------------------------------------------
ccl28's Profile: http://www.excelforum.com/member.php...o&userid=36095
View this thread: http://www.excelforum.com/showthread...hreadid=565869