View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz[_2_] JLGWhiz[_2_] is offline
external usenet poster
 
Posts: 1,565
Default copy past two existing sheets into 30 workbooks

I need to proof read these before entering. Change the + To _

You will need something like this:

Sub dk()
For Each wb In myFolder.Workbooks
For i = 1 To 2
Workbooks("Master").Sheets(i).Copy _
After:=wb.Sheets(wb.Sheets.Count)
Next
Next
End Sub

This is totally untested and is only to give guidance as to structure for
creating a workable loop to go through the folder of files and copy
worksheets to them. Some things that have to happen are, each workbook in
the folder will have to be opened and then closed after the copy event. The
myFolder variable will need to include path.





"JLGWhiz" wrote in message
...
You will need something like this:

Sub dk()
For Each wb In myFolder.Workbooks
For i = 1 To 2
Workbooks("Master").Sheets(i).Copy +
After:=wb.Sheets(wb.Sheets.Count)
Next
Next
End Sub

This is totally untested and is only to give guidance as to structure for
creating a workable loop to go through the folder of files and copy
worksheets to them. Some things that have to happen are, each workbook in
the folder will have to be opened and then closed after the copy event.
The myFolder variable will need to include path.




"raffrobb" wrote in message
...
I want to copy paste two existing sheets into 30 workbooks in a
folder.
The sheets are in a workbook called Master, and I need to make a copy/
move and insert into each workbook within the folder.

What is the simplest way to do this via VBA?

Thanks,
Robb