View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel[_893_] joel[_893_] is offline
external usenet poster
 
Posts: 1
Default Adding ws information to cell in new wb & saving with ws name


Assume the macro will go into the workbook Trollie and the the UDF file
and ne workbooks will be located in the same folder as Trollie.

Sub CopySheets()

'asume the workbooks will be ased in the same
'folder as the current workbook
Folder = ThisWorkbook.FullName
'remove filename from folder
Folder = Left(Folder, InStrRev(Folder, "\"))

For Each sht In Sheets
FName = sht.Name
Set bk = Workbooks.Open(Filename:=Folder & "UDF.xls")
With bk.Sheets(1)
sht.Range("A1") = .Range("C79")
sht.Range("A2") = .Range("C80")
sht.Range("A3") = .Range("C81")
sht.Range("A4") = .Range("C88")
sht.Range("A5") = .Range("C89")
sht.Range("A6") = .Range("C91")
sht.Range("A7") = .Range("C95")
End With

bk.SaveAs Filename:=Folder & FName
bk.Close
Next sht

End Sub


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?u=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=195354

http://www.thecodecage.com/forumz