- ©«¤l
- 438
- ¥DÃD
- 67
- ºëµØ
- 0
- ¿n¤À
- 531
- ÂI¦W
- 30
- §@·~¨t²Î
- win7
- ³nÅ骩¥»
- office 2010
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-10-30
- ³Ì«áµn¿ý
- 2024-11-19
|
¦^´_ 4# GBKEE - ption Explicit
- Sub ex()
- Dim FRng As Range, Wb As Workbook
- Dim A As Range, Rng As Range
- Dim fs As String, xi As Integer
- fs = "C:\Documents and Settings\USER\®à±\payment report 2012.xlsx"
- Set Wb = Workbooks.Open(fs)
- Set FRng = Wb.Sheets("New form of payment report").Range("k:k").Find(Date, lookat:=xlWhole, SearchDirection:=xlPrevious) '¦bb.xlsx ªºKÄæ´M§äµ¥·í¤éªº¤é´Áªº¤@¦C
- If Not FRng Is Nothing Then '°²¦p§ä¨ì
- If FRng.Offset(, -3).Value >= 0.95 [color=Red]And FRng.Offset(, -3).Value <> " "[/color] Then '°²¦pb.xlsx ³o¦CªºHÄ檺Ȥj¹L©Îµ¥©ó0.95
- Set Rng = Workbooks("outstanding payments").Sheets("outstanding payments").Range("a:a").Find(FRng.Offset(, -9), lookat:=xlWhole, SearchDirection:=xlPrevious) ' ¦ba.xlsx ªºAÄæ´M§äb.xlsx ³o¦CªºBÄ檺ȬO§_¦s¦b
- [color=Red]If Rng Is Nothing Then [/color]'°²¦p§ä¤£¨ì
- [color=Red]With Workbooks("outstanding payments").[/color]Sheets("outstanding payments") ' ¦ba.xlsx ªºAÄæ³Ì«á¤@¦C¥[¤Wb.xlsx ³o¦CªºBÄ檺ȡA¤Î ¦ba.xlsx ªºFÄæ³Ì«á¤@¦C¥[¤Wb.xlsx ³o¦CªºKÄ檺È
- xi = .UsedRange.Cells(.UsedRange.Count).Row
- .UsedRange.Cells(xi, "A") = FRng.Offset(, -9).Value
- .UsedRange.Cells(xi, "F") = FRng.Value
-
- End With
- End If
-
- End If
- End If
- Wb.Close 0
- End Sub
½Æ»s¥N½X ¤§«eIf Rng Is Nothing Then ¼g¿ù¦¨ If FRng Is Nothing Then ¡A¦ý¬O§ï§¹¤F¤]¨S¦³¤ÏÀ³¡A¥u¬O¥´¶}¥t¤@Óexcel«á´N¨S¦³¤°»ò¤ÏÀ³¡A¬Oþ¸Ì¥X²{°ÝÃD¤F¡A½Ð«ü©w°g¬z¡C ¤£ºÞ³Ì«á¤@¦C¬O§_HÄæ¬O§_ªÅ®æ©ÎªÌ¦Ê¥÷¤§´X³£¨S¦³¤ÏÀ³¡A¥t¥~ Set FRng = Wb.Sheets("New form of payment report").Range("k:k").Find(Date, lookat:=xlWhole, SearchDirection:=xlPrevious) ¬O§_·|¤£°±¦a©¹¤W´M§ä,ª½¨ì²Ä¤@¦C¬°¤î¡H |
|