ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ¸ê®Æ®w±ø¥ó¸ê®Æ§ì¨ú°ÝÃD½Ð±Ð

[µo°Ý] ¸ê®Æ®w±ø¥ó¸ê®Æ§ì¨ú°ÝÃD½Ð±Ð

DEAR ALL ¤j¤j
1.¨Ò
SHEET1.RABGE "A"  "B"  "C"Äd¸ê®Æ¦p¤U
»Ý¨D¬°§ì¨ú«~¦W¬Û¦P AND ®É¶¡³Ì·s¤§¸Ó¦C¸ê®Æ¦Ü SHEET2.¤¤
«~¦W       ®É¶¡             ¤º®e
¥Ò   106/01/11 15:20          A
¥Ò   106/01/13 15:10          B
¤w   106/01/10 15:00          C
¥Ò   106/01/05 05:00          D
¤A   106/01/10 14:10          E
¥Ò   106/01/03 16:53          F
¤A   106/01/13 15:20          G
.........................................
2.µ²ªG
»Ý¨D¬°§ì¨ú«~¦W¬Û¦P AND ®É¶¡³Ì·s¤§¸Ó¦C¸ê®Æ¦Ü SHEET2.¤¤
¦p¤U
«~¦W       ®É¶¡             ¤º®e
¥Ò   106/01/13 15:10          B
¤A   106/01/13 15:20          G
3.·Ð¤£§[½ç±Ð.
ù

http://blog.xuite.net/hcm19522/twblog/480500968

TOP

DEAR  SIRS-
¤p§Ì¬O­n¥ÎVBA§¹¦¨.«D¨ç¼Æ¤è¦¡.THANKS*10000
ù

TOP

¦^´_ 3# rouber590324


´M¨DVBA¨ó§U, »Ý­nÀÉ®×°µ¬°°ò©³, ³Ì¦n¯à¤W¶ÇÀɮ׬°©y!

TOP

¦^´_ 1# rouber590324


    ¤USQL«ü¥O?

TOP

¦^´_ 1# rouber590324
  1. Sub test()
  2.     Dim sql$, pn$
  3.     Sheet2.Cells.ClearContents
  4.     Sheet2.Range("b:b").NumberFormatLocal = "yyyy/m/d h:mm;@"
  5.     pn = ThisWorkbook.FullName
  6.     sql = "select «~¦W,last(®É¶¡) as ®É¶¡,last(¤º®e) as ¤º®e from [sheet1$] where «~¦W<>null group by «~¦W"
  7.     SqCopy pn, sql, Sheet2.[a2], Sheet2.[a1]
  8. End Sub
  9. Sub SqCopy(pt As String, sq As String, Optional Rg As Range, Optional rg1 As Range)
  10.     Dim conn As Object, rst As Object, i%
  11.     Set conn = CreateObject("adodb.connection")
  12.     Set rst = CreateObject("ADODB.recordset")
  13.     Select Case Application.Version * 1
  14.     Case Is <= 11
  15.         conn.Open "Provider=Microsoft.Jet.Oledb.4.0;Extended Properties='excel 8.0;hdr=yes;imex=1';data source=" & pt
  16.     Case Is >= 12
  17.         conn.Open "Provider=Microsoft.ACE.OLEDB.12.0;extended properties='excel 12.0;hdr=yes;imex=1';data source=" & pt
  18.     End Select
  19.     Set rst = conn.Execute(sq)
  20.     If Not rg1 Is Nothing Then
  21.         For Each Field In rst.Fields
  22.             rg1.Offset(0, i) = Field.Name
  23.             i = i + 1
  24.         Next
  25.     End If
  26.     If Not Rg Is Nothing Then
  27.         Rg.CopyFromRecordset rst
  28.     End If
  29.     conn.Close
  30.     Set rst = Nothing
  31.     Set conn = Nothing
  32. End Sub
½Æ»s¥N½X

TOP

·PÁ¦U¬°¤j¤j¦^ÂР THANKS*10000
¤p§Ì¤§¤½¥q¹q¸£ÂêµLªk¤W¶ÇÀÉ®× SORRY
ù

TOP

        ÀR«ä¦Û¦b : ¦Û¤v®`¦Û¤v¡A²ö¹L©ó¶ÃµoµÊ®ð¡C
ªð¦^¦Cªí ¤W¤@¥DÃD