View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Nigel[_2_] Nigel[_2_] is offline
external usenet poster
 
Posts: 735
Default HELP= Problems Copying WorkBook Sheets

Your code should work, and works for me. But only if var Y has a valid index
number for a sheet in the sourceBk.

Have you checked this value?

--

Regards,
Nigel




"tommo_blade" wrote in message
...
I am still getting the same problem, i.e. an error with the following
lines:-

sourceBk.Worksheets(y).Copy _
After:=wbMaster.Worksheets(wbMaster.Worksheets.Cou nt)

I have added the code at the very top to set 'wbMaster' as you stated,
so:-

Sub import_xls()
Dim y As Integer
Dim d As Integer
Dim p As Integer
Dim c As Integer
Dim wbMaster As Workbook

Set wbMaster = ActiveWorkbook
Folder = "F:\My Documents\Fantasy Football\XLS_Emails\"
FName = Dir(Folder & "*.xls")
Application.ScreenUpdating = False

<< MORE CODE HERE



thanks in advance for any assistance, Mark.