1¡^Sub txet1()
P = Format(Date, "m") & "-" & Format(Date, "d") & "-" & Format(Date, "Y")
VBA.FileCopy "Y:\2012\payment 2012\Outstanding payment ss 2012\Dec 2012\Outstanding Payments " & P & ".xlsm", "C:\users\patrick.hkg\desktop\outstanding payments.xlsm"
End Sub
§Úªºfile ¦W¬O Outstanding Payments 12-4-2012
run ¬O¥X²{run-time error '53': file not found ½Ð°Ý¬Oþ¸Ì¥X¿ù¤F¡H
p »ÝnSET¤°»ò¶Ü¡HDIM P AS STRING ¤§Ãþ¶Ü¡H
Sub txet1()
'³æ¯Â½Æ»s§ó¦W
P = Format(Date, "m") & "-" & Format(Date, "d") & "-" & Format(Date, "Y")
VBA.FileCopy "Y:\2012\payment 2012\Outstanding payment ss 2012\Dec 2012\OutstandingPayments " & P & ".xlsm", "C:\users\patrick.hkg\desktop\outstandingpayments.xlsm"
End Sub
Sub txet1()
'³æ¯Â½Æ»s§ó¦W
P = Format(Date, "m") & "-" & Format(Date, "d") & "-" & Format(Date, "Y")
VBA.FileCopy "Y:\2012\payment 2012\Outstanding payment ss 2012\Dec 2012\OutstandingPayments " & P & ".xlsm", "C:\users\patrick.hkg\desktop\outstandingpayments.xlsm"
End Sub
'With Workbooks.Open("C:\Users\patrick.HKG\Desktop\COPY.XLSM").Sheets("2012")
With Workbooks("payment.XLSM").Sheets("2012")
.Range("A1").CurrentRegion.Offset(1) = ""
Set Rng(1) = .[A2]
With Workbooks.Open("C:\Users\patrick.HKG\Desktop\Jenny.XLSX").Sheets("SHEET1")
Set Rng(2) = .[A2:AL2]
Set Rng(2) = .Range(Rng(2), .[A2].End(xlDown))
Rng(2).copy Rng(1)
.Parent.Close False
End With
Set Rng(1) = Rng(1).End(xlDown).Offset(1)
With Workbooks.Open("C:\Users\patrick.HKG\Desktop\Jane.XLSX").Sheets("SHEET1")
Set Rng(2) = .[A2:AL2]
Set Rng(2) = .Range(Rng(2), .[A2].End(xlDown))
Rng(2).copy Rng(1)
.Parent.Close False
End With
Set Rng(1) = Rng(1).End(xlDown).Offset(1)
With Workbooks.Open("C:\Users\patrick.HKG\Desktop\Lily.XLSX").Sheets("sheet1")
Set Rng(2) = .[A2:AL2]
Set Rng(2) = .Range(Rng(2), .[A2].End(xlDown))
Rng(2).copy Rng(1)
.Parent.Close False
End With
Set Rng(1) = Rng(1).End(xlDown).Offset(1)
With Workbooks.Open("C:\Users\patrick.HKG\Desktop\Connie.XLSX").Sheets("sheet1")
Set Rng(2) = .[A2:AL2]
Set Rng(2) = .Range(Rng(2), .[A2].End(xlDown))
Rng(2).copy Rng(1)
.Parent.Close False
End With
Set Rng(1) = Rng(1).End(xlDown).Offset(1)
With Workbooks.Open("C:\Users\patrick.HKG\Desktop\Patrick.XLSX").Sheets("sheet1")
Set Rng(2) = .[A2:AL2]
Set Rng(2) = .Range(Rng(2), .[A2].End(xlDown))
Rng(2).copy Rng(1)
.Parent.Close False
End With
End With
End Sub
Set Rng(1) = .[A2]
With Workbooks.Open("C:\Users\patrick.HKG\Desktop\Jenny.XLSX").Sheets("SHEET1")
Set Rng(2) = .[A2:AL2]
Set Rng(2) = .Range(Rng(2), .[A2].End(xlDown))
Rng(2).copy Rng(1)
.Parent.Close False
End With
Set Rng(1) = Rng(1).End(xlDown).Offset(1)
With Workbooks.Open("C:\Users\patrick.HKG\Desktop\Jane.XLSX").Sheets("SHEET1")
Set Rng(2) = .[A2:AL2]
Set Rng(2) = .Range(Rng(2), .[AL2].End(xlDown))
Set Rng(2) = Rng(2).Resize(.[E1].End(xlDown).Row - 1)
Rng(2).copy Rng(1)
.Parent.Close False
End With
Set Rng(1) = Rng(1).End(xlDown).Offset(1)
With Workbooks.Open("C:\Users\patrick.HKG\Desktop\Lily.XLSX").Sheets("sheet1")
Set Rng(2) = .[A2:AL2]
Set Rng(2) = .Range(Rng(2), .[AL2].End(xlDown))
Set Rng(2) = Rng(2).Resize(.[E1].End(xlDown).Row - 1)
Rng(2).copy Rng(1)
.Parent.Close False
End With
Set Rng(1) = Rng(1).End(xlDown).Offset(1)
With Workbooks.Open("C:\Users\patrick.HKG\Desktop\Connie.XLSX").Sheets("sheet1")
Set Rng(2) = .[A2:AL2]
Set Rng(2) = .Range(Rng(2), .[AL2].End(xlDown))
Set Rng(2) = Rng(2).Resize(.[E1].End(xlDown).Row - 1)
Rng(2).copy Rng(1)
.Parent.Close False
End With
Set Rng(1) = Rng(1).End(xlDown).Offset(1)
With Workbooks.Open("C:\Users\patrick.HKG\Desktop\Patrick.XLSX").Sheets("sheet1")
Set Rng(2) = .[A2:AL2]
Set Rng(2) = .Range(Rng(2), .[AL2].End(xlDown))
Set Rng(2) = Rng(2).Resize(.[E1].End(xlDown).Row - 1)
Rng(2).copy Rng(1)
.Parent.Close False
End With
End With
End Sub
Set Rng(1) = Rng(1).End(xlDown).Offset(1) ¥X²{ERROR :RUN-TIME ERROR '1004'; APPLICATION-DEFINED OR OBJECT-DEFINED ERROR§@ªÌ: 198188 ®É¶¡: 2012-12-7 09:02
Set Rng(1) = .[A2]
With Workbooks.Open("C:\Users\patrick.HKG\Desktop\Jenny.XLSX").Sheets("SHEET1")
Set Rng(2) = .[A2:AL2]
Set Rng(2) = .Range(Rng(2), .[e2].End(xlDown))
Rng(2).copy Rng(1)
.Parent.Close False
End With
Set Rng(1) = Rng(1).End(xlDown).Offset(1)
With Workbooks.Open("C:\Users\patrick.HKG\Desktop\Jane.XLSX").Sheets("SHEET1")
Set Rng(2) = .[A2:AL2]
Set Rng(2) = .Range(Rng(2), .[AL2].End(xlDown))
Set Rng(2) = Rng(2).Resize(.[E1].End(xlDown).Row - 1)
[attach]13425[/attach][attach]13426[/attach][attach]13427[/attach][attach]13428[/attach][attach]13429[/attach][attach]13430[/attach]
Option Explicit
Sub copy()
Dim Rng(1 To 2) As Range
'With Workbooks.Open("C:\Users\patrick.HKG\Desktop\COPY.XLSM").Sheets("2012")
With Workbooks("payment.XLSM").Sheets("2012")
.Range("A1").CurrentRegion.Offset(1) = ""
Set Rng(1) = .[a2]
With Workbooks.Open("C:\Users\patrick.HKG\Desktop\Jenny.XLSX").Sheets("SHEET1")
Set Rng(2) = .[A2:L2]
Set Rng(2) = .Range(Rng(2), .[a2].End(xlDown))
Rng(2).copy Rng(1)
.Parent.Close False
End With
Set Rng(1) = Rng(1).End(xlDown).Offset(1)
With Workbooks.Open("C:\Users\patrick.HKG\Desktop\Jane.XLSX").Sheets("SHEET1")
Set Rng(2) = .[A2:L2]
Set Rng(2) = .Range(Rng(2), .[a2].End(xlDown))
Set Rng(2) = Rng(2).Resize(.[E1].End(xlDown).Row - 1)
Rng(2).copy Rng(1)
.Parent.Close False
End With
Set Rng(1) = Rng(1).End(xlDown).Offset(1)
With Workbooks.Open("C:\Users\patrick.HKG\Desktop\Lily.XLSX").Sheets("sheet1")
Set Rng(2) = .[A2:L2]
Set Rng(2) = .Range(Rng(2), .[a2].End(xlDown))
Set Rng(2) = Rng(2).Resize(.[E1].End(xlDown).Row - 1)
Rng(2).copy Rng(1)
.Parent.Close False
End With
Set Rng(1) = Rng(1).End(xlDown).Offset(1)
With Workbooks.Open("C:\Users\patrick.HKG\Desktop\Connie.XLSX").Sheets("sheet1") Set Rng(2) = .[A2:L2]
Set Rng(2) = .Range(Rng(2), .[a2].End(xlDown))
Set Rng(2) = Rng(2).Resize(.[E1].End(xlDown).Row - 1)
Rng(2).copy Rng(1)
.Parent.Close False
End With
Set Rng(1) = Rng(1).End(xlDown).Offset(1)
With Workbooks.Open("C:\Users\patrick.HKG\Desktop\Patrick.XLSX").Sheets("sheet1")
Set Rng(2) = .[A2:L2]
Set Rng(2) = .Range(Rng(2), .[a2].End(xlDown))
Set Rng(2) = Rng(2).Resize(.[E1].End(xlDown).Row - 1)
Rng(2).copy Rng(1)
.Parent.Close False
End With
End With
End Sub
§Ú¥Î¤F¤W±ªºµ{¦¡¡A¦ý¥X¨Óªºresult«oµLªk¥þ³¡¥X¨Ó¡C½Ð°Ýþ¸Ì»Ýn§ï¡H§@ªÌ: GBKEE ®É¶¡: 2012-12-7 17:07
¦^´_ 40#198188
With Workbooks.Open("C:\Users\patrick.HKG\Desktop\Patrick.XLSX").Sheets("SHEET1")
±N¦¹ÀÉ®×»P¥¼¥X¿ùÀÉ®×¹ï½Õ¬Ý¬O§_¤@¼Ëªº¥X¿ù,¥i¨Ì¤U¤èµ{§Ç¬Ý¬Ý