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

[µo°Ý] ½Ð°Ý°ª¤â¦p¦ó¿z¿ï²Ä¤@µ§¤Î³Ì«á¤@µ§

[µo°Ý] ½Ð°Ý°ª¤â¦p¦ó¿z¿ï²Ä¤@µ§¤Î³Ì«á¤@µ§

¤½¥q¦³¤@¨Ç¥dÄÁ¸ê®Æ
¨Ò¦p:20100826,0827,1234
       20100826,0844,3586
      20100826,1844,7896
¤å¦rÀÉ,§Ú­n¦p¦ó¼g¤@­ÓVBA¦Û°Ê¿z¿ï¾¹,¿z¿ï¤å¦rÀɨC­Ó¤H²Ä¤@µ§¤Î³Ì«á¤@µ§¸ê®Æ,Åý§Ú®a¤p©j¥Î,½Ð°ª¤â«üÂI¤p§ÌÁÂÁÂ!!

¤½¥q¦³¤@¨Ç¥dÄÁ¸ê®Æ
¨Ò¦p:20100826,0827,1234
       20100826,0844,3586
      20100826,1844,7896
¤å ...
anotny µoªí©ó 2010-8-30 21:39


¤èªk¦³«Ü¦h, ³o­Ó¬O¿ï¤W¤åÀɪ½±µ¶×¤J
  1.    
  2. sub test()
  3. Dim filename As String

  4.     With Application.FileDialog(msoFileDialogOpen)
  5.         .AllowMultiSelect = False
  6.         .Show
  7.         If .SelectedItems.Count > 0 Then
  8.             filename = .SelectedItems(1)
  9.         Else
  10.             Exit Sub
  11.         End If
  12.     End With

  13.    
  14.     Dim oFSO
  15.     Set oFSO = CreateObject("Scripting.FileSystemObject")
  16.     Set sdmax = CreateObject("Scripting.Dictionary")
  17.     Set sdmin = CreateObject("Scripting.Dictionary")

  18.     Dim strDate As String
  19.     Dim strTime As String
  20.     Dim strNo As String
  21.     Set oFS = oFSO.OpenTextFile(filename)

  22.     Do Until oFS.AtEndOfStream
  23.         sText = oFS.ReadLine
  24.         strDate = Split(sText, ",")(0)
  25.         strTime = Split(sText, ",")(1)
  26.         strNo = Split(sText, ",")(2)
  27.         
  28.         If sdmin.exists(strNo) Then
  29.             sdmax(strNo) = strTime
  30.         Else
  31.             sdmin.Add strNo, strTime
  32.             sdmax.Add strNo, strTime
  33.         End If
  34.         
  35.     Loop
  36.    
  37.     Range("A1").Resize(sdmin.Count, 1).Value = Application.Transpose(sdmin.keys)
  38.     Range("B1").Resize(sdmin.Count, 1).Value = Application.Transpose(sdmin.items)
  39.     Range("C1").Resize(sdmin.Count, 1).Value = Application.Transpose(sdmax.items)
  40.     Set sdmin = Nothing
  41.     Set sdmax = Nothing
  42.     oFS.Close
  43.     oFSO = Null
  44. end sub
½Æ»s¥N½X
À´±oµo°Ý,µª®×´N·|¦b¨ä¤¤

¤µ¤éの¤@¬íは  ©ú¤éにない
http://kimbalko-chi.blogspot.com
http://kimbalko.blogspot.com

TOP

        ÀR«ä¦Û¦b : ¹D¼w¬O´£ª@¦Û§Úªº©ú¿O¡A¤£¸Ó¬O¨þ¥¸§O¤HªºÃ@¤l¡C
ªð¦^¦Cªí ¤W¤@¥DÃD