Type Mismatch

E

Edgar

Hi Experts

This code keeps coming up with the error 'Mismatch' on
line: Windows(outfile).Activate

Does anyone know why?
 
E

Edgar

Sorry forgot code....!!!!

Sub Create_Remittance()

For i = 4 To Sheets.Count
Set sh = Sheets(i)
sh.Activate

File_Name = ActiveWorkbook.Worksheets("Menu").Cells.Range
("D9").Value

Set outfile = Workbooks.Open(File_Name)
Windows("Remittance Module.xls").Activate

Range("B1").Copy Destination:=outfile.Worksheets
("Remittance").Range("B6")
Range("C1").Copy Destination:=outfile.Worksheets
("Remittance").Range("B8")
Range("F1").Copy Destination:=outfile.Worksheets
("Remittance").Range("B10")

Range("A1:A" & Cells(Rows.Count, 1).End(xlUp).Row).Copy
Destination:=outfile.Worksheets("Remittance").Range("A16")
Range("D1:D" & Cells(Rows.Count, 1).End(xlUp).Row).Copy
Destination:=outfile.Worksheets("Remittance").Range("B16")
Range("G1:G" & Cells(Rows.Count, 1).End(xlUp).Row).Copy
Destination:=outfile.Worksheets("Remittance").Range("C16")
Range("H1:H" & Cells(Rows.Count, 1).End(xlUp).Row).Copy
Destination:=outfile.Worksheets("Remittance").Range("D16")

Windows(outfile).Activate
Supp_Name = Range("B8")
Trans_No = Range("B10")
Trans_Date = Range("B6")

ActiveWorkbook.SaveAs ("C:\Documents and Settings\ThoemmE1
\Desktop\Remittance Project\Remittance\" & Supp_Name & " "
& Trans_No & " " & Trans_Date & ".xls")
ActiveWorkbook.Close


Next i

ActiveWorkbook.Sheets("Menu").Select

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top