Thread: Type Mismatch
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Type Mismatch

Answer would be the same

outfile.activate

or

Windows(outfile.name).Activate

--
Regards,
Tom Ogilvy

"Edgar" wrote in message
...
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").Rang e("A16")
Range("D1:D" & Cells(Rows.Count, 1).End(xlUp).Row).Copy
Destination:=outfile.Worksheets("Remittance").Rang e("B16")
Range("G1:G" & Cells(Rows.Count, 1).End(xlUp).Row).Copy
Destination:=outfile.Worksheets("Remittance").Rang e("C16")
Range("H1:H" & Cells(Rows.Count, 1).End(xlUp).Row).Copy
Destination:=outfile.Worksheets("Remittance").Rang e("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