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

[µo°Ý] §ó·s¤U¸ü³t«×¡B¦s¨ú°ÝÃD

[µo°Ý] §ó·s¤U¸ü³t«×¡B¦s¨ú°ÝÃD

¥»©«³Ì«á¥Ñ spermbank ©ó 2011-9-24 15:43 ½s¿è

1:°õ¦æ [©Ò¦³¾ú¥vªÑ»ù«ö¶s] ¦s¦¨.csvÀÉ¡Aµo²{¦s¨úÀɮ׳t«×«D±`ºC
  °Ý:¦p¦ó­×§ïµ{¦¡´£¤É¤U¸ü³t«×?

2:¦p¦óŪ¨ú¥N¸¹1101.csv²Ä1Äæ©Ò¦³¤é´Á(data)¡A¼g¤Jexcel¤¤ªºsheet2ªº²Ä1¦C¤¤¡A¨Ã¥BŪ¨ú©Ò¦³*.csvÀɮפ¤ªº²Ä5Äæ(close)ªº¸ê®Æ¡A¨Ì§Ç¹ï·ÓÀɦW»P²Ä1Ä椤ªº¥N¸¹±N²Ä5Äæ¸ê®Æ¼g¤J¦U¥N¸¹ªº¦C¦ì¤¤.
  ¦¹°ÝÃD¦³ª¦¤å´M§ä¬ÛÃö°ÝÃD¸Õ¼g¡A¥i¬OÁÙ¬O¼g¤£¥X¨Ó¡A·Q½Ð°Ý¦U¦ì¤j¤j¡C

  PS:ªþ¥[:ªþ¥ótext1 PS:ÁÙ¬O¤p¾Ç¥Í¡A¥i½Ð¤j¤j¼g§¹¡Aµ{¦¡½X¥Î¶K¡AÁÂÁ¡C

text.rar (100.62 KB)

¦^´_ 19# spermbank
¤u§@ªíÀx¦s®æ¸Ìªº¨ç¼Æ =TODAY()

TOP

¤j¤j©p¦n:
Á|¨Ò:
Àx¦s®æ = NOW()  Åã¥Ü·í¤é¤é´Á 2011/9/29  03:19:06 AM
¦³¤°»ò¨ç¦¡¥i¥H Åã¥Ü·í¤é 2011/9/29 ¦Ó¤£¬O¥Î    Selection.NumberFormatLocal = "yyyy/m/d"

¦]¬°§Ú­n¼g§PÂ_Àx¦s®æªº¤é´Á¡A¦ý¬O¦h¤F03:19:06 AM
Åý§Ú¦b§PÂ_Àx¦s®æªº®É­Ôµo¥Í¿ù»~

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2011-9-27 10:58 ½s¿è

¦^´_ 16# spermbank
¥i¥H§ï¦¨           Set CsvRange = OpCsv.Sheets(1).Columns(1).SpecialCells(xlCellTypeConstants).Offset(1)
Range ("A:A") =>Columns("A:A")  ³æÄæ Columns(1)
Range ("A:B") >= Columns("A:B")   
­n«ç»ò¥ý§â²Ä6Äæ(Volume)©Ò¦³­È³£¥ý°£¥H1000¦A¦s¤JSheet2©O?
AR = Application.Transpose(CsvRange) ->°}¦C±qÀx¦s®æ¾É¤J­È®É ¨C¤@ºû«×ªº¤U­­³£¬O±q1 ¶}©l  ->For i = 1 To UBound(AR)
  1. AR = Application.Transpose(CsvRange)
  2. For i = 1 To UBound(AR)
  3. AR(i) = AR(i) / 1000
  4. Next
  5. TheRow.Offset(, 2).Resize(, CsvRange.Rows.Count) = AR
½Æ»s¥N½X
¦^´_ 17# spermbank
  1. Sub Ex()
  2.     Dim x As Double, i As Double, AA()
  3.     x = Application.WorksheetFunction.CountA(Range("A:A")) 'Äæ¦ì¦³­È½d³ò­pºâ
  4.     ReDim AA(2 To x, 1 To 4)    '2 To x-> ²Ä¤@ºû «ü©w±q 2 ¨ì X
  5.                                 '1 To 4-> ²Ä¤Gºû «ü©w±q 1 ¨ì 4
  6.     For i = 2 To x              '°t¦X°}¦Cºû«×ªº¤W¤U­­
  7.         With Application
  8.         'With Application.WorksheetFunction                  '¥¿²Î¼gªk
  9.             AA(i, 1) = .Sum(Cells(i, 3).Resize(, 5)) / 5
  10.             AA(i, 2) = .Average(Range("A" & i).Resize(, 20))  '20¤é-20­ÓÀx¦s®æ¤¤ªº¼Æ­È¥­§¡
  11.             AA(i, 3) = .Average(Range("A" & i).Resize(, 60))  '60¤é
  12.             AA(i, 4) = .Average(Range("A" & i).Resize(, 120)) '120¤é
  13.         End With
  14.     Next
  15. End Sub
  16. Sub Ex1()
  17.     x = Application.WorksheetFunction.CountA(Range("A:A")) 'Äæ¦ì¦³­È½d³ò­pºâ
  18.     Dim AA(2000, 3)     '2000-> ²Ä¤@ºû 0-2000 ¦@20001­Ó
  19.                         '3   -> ²Ä¤Gºû 0-3    ¦@4­Ó
  20.     For i = 2 To x
  21.         AA(i - 2, 0) = (Cells(i, 3) + Cells(i, 4) + Cells(i, 5) + Cells(i, 6) + Cells(i, 7)) / 5
  22.         AA(i - 2, 1) = Application.WorksheetFunction.Average(Range("A" & i & ": V" & i)) '20¤é-20­ÓÀx¦s®æ¤¤ªº¼Æ­È¥­§¡
  23.         AA(i - 2, 2) = Application.WorksheetFunction.Average(Range("A" & i & ": BJ" & i)) '60¤é
  24.         AA(i - 2, 3) = Application.WorksheetFunction.Average(Range("A" & i & ": DR" & i)) '120¤é
  25.     Next
  26. End Sub
½Æ»s¥N½X

TOP

x = Application.WorksheetFunction.CountA(Range("A:A")) 'Äæ¦ì¦³­È½d³ò­pºâ
    Dim AA(2000, 4)
    For i = 2 To x
        AA(i, 1) = (Cells(i, 3) + Cells(i, 4) + Cells(i, 5) + Cells(i, 6) + Cells(i, 7)) / 5
        AA(i, 2) = Application.WorksheetFunction.Average(Range("A" & i, "V" & i))  '20¤é-20­ÓÀx¦s®æ¤¤ªº¼Æ­È¥­§¡
        AA(i, 3) = Application.WorksheetFunction.Average(Range("A" & i, "BJ" & i)) '60¤é
        AA(i, 4) = Application.WorksheetFunction.Average(Range("A" & i, "DR" & i)) '120¤é
    Next

       ·Q°µ¥­§¡­È¡A¥i¬Oµo²{¥u¦³A(i,1)ªº¼Æ­È¹ï
       ¥t¥~A(i,2)¡BA(i,3)¡BA(i,4)ªº¼Æ­È³£¬O¿ùªº
       ¥i§_½Ð¤j¤jÀ°§Ú¸ÑBUG

TOP

¥»©«³Ì«á¥Ñ spermbank ©ó 2011-9-27 00:23 ½s¿è

¦^´_ 15# GBKEE

¤j¤jÁÂÁ§A¡Aµ{¦¡¯à¶¶§Q¶]¡A«¢«¢¡A:$
¥i¬Oµo²{¤@­Ó°ÝÃD¡AŪ¨ú¤@­Ócsv´N·|¶}±Ò¤@­ÓexcelÀɮסA¾É­P¤u§@¦CExcel¹L¦h·|Ãz±¼¡A
µ{¦¡¤j·§¥i¥H5¤ÀÄÁ¶]§¹¡A¶]§¹´N«ì´_¥¿±`¡AÁÙ¥i¥Hµ¥«Ý¡C
¥i¬O¬O¤£¬O¦³¿ìªk¸Ñ¨M³o­Ó°ÝÃD©O??

¥t¥~:
12.              Set CsvRange = OpCsv.Sheets(1).Range("A:A").SpecialCells(xlCellTypeConstants).Offset(1) '³]©w½d³ò
ÁöµM§Ú¬Ý¤£À´«á­±ªº³]©w¡A¦ý¬O¥i¤£¥i¥H§ï¦¨
12.              Set CsvRange = OpCsv.Sheets(1).Columns(1).SpecialCells(xlCellTypeConstants).Offset(1) '³]©w½d³ò
¥t¥~:
                Set CsvRange = OpCsv.Sheets(1).Columns(6).SpecialCells(xlCellTypeConstants).Offset(1)  '³]©w*.csvÀɮפ¤ªº²Ä6Äæ(Volume)ªº¸ê

                TheRow.Offset(, 2).Resize(, CsvRange.Rows.Count) = Application.Transpose(CsvRange)

­n«ç»ò¥ý§â²Ä6Äæ(Volume)©Ò¦³­È³£¥ý°£¥H1000¦A¦s¤JSheet2©O?

TOP

¦^´_ 14# spermbank
  1. Sub «ö¶s7_Click()
  2.     Dim TheCsv As String, ThePath As String, OpCsv As Workbook, CsvRange As Range, TheRow As Variant
  3.     ThePath = Sheets("Sheet1").Range("F9")                                          'D:\data\   ½Ð¥[¤W"\"
  4.     TheCsv = Dir(ThePath & "*.CSV")                                                 '¶Ç¦^²Å¦Xªº²Ä¤@­ÓÀɮצWºÙ
  5.     If TheCsv = "" Then MsgBox ThePath & " ¨S¦³ CSVÀÉ®×": Exit Sub
  6.     Application.ScreenUpdating = False
  7.     With Sheets("Sheet2")
  8.         If .[C1] <> "" Then .Range(.[C1], .[C1].End(xlToRight).End(xlDown)) = ""    '²MªÅ¸ê®Æ
  9.         Do While TheCsv <> ""
  10.             Set OpCsv = Workbooks.Open(ThePath & TheCsv)                            '¥´¶} Csv
  11.             If .[C1] = "" Then                                                      '¾É¤J¤é´Á
  12.                 Set CsvRange = OpCsv.Sheets(1).Range("A:A").SpecialCells(xlCellTypeConstants).Offset(1) '³]©w½d³ò
  13.                 'SpecialCells ->¯S®íÀx¦s®æ ,°Ñ¼Æ(xlCellTypeConstants->¥]§t±`¼ÆªºÀx¦s®æ
  14.                 .[C1].Resize(, CsvRange.Rows.Count) = Application.Transpose(CsvRange)   'Âà¸m-> Application.Transpose(½d³ò)
  15.             End If
  16.             TheRow = Replace(UCase(TheCsv), ".CSV", "")                                 'Replace ->´À´«¤å¦r
  17.             Set TheRow = .Range("A:A").Find(TheRow, LOOKAT:=xlWhole)                    '´M§ä *.CSV ¦bSheets("Sheet2")ªº¦ì¸m
  18.             If Not TheRow Is Nothing Then                                               '§ä¨ì *.CSV ¦bSheets("Sheet2")ªº¦ì¸m
  19.                 Set CsvRange = OpCsv.Sheets(1).Columns(5).SpecialCells(xlCellTypeConstants).Offset(1)  '³]©w*.csvÀɮפ¤ªº²Ä5Äæ(close)ªº¸ê
  20.                 TheRow.Offset(, 2).Resize(, CsvRange.Rows.Count) = Application.Transpose(CsvRange)
  21.             End If
  22.             OpCsv.Close False
  23.             TheCsv = Dir
  24.         Loop
  25.     End With
  26.     Application.ScreenUpdating = True
  27. End Sub
½Æ»s¥N½X

TOP

¥»©«³Ì«á¥Ñ spermbank ©ó 2011-9-26 01:41 ½s¿è

¦^´_ 13# GBKEE


    °ÝÃD2: ¦p¦óŪ¨ú¥N¸¹1101.csv²Ä1Äæ©Ò¦³¤é´Á(data)¡A¼g¤Jexcel¤¤ªºsheet2ªº²Ä1¦C¤¤¡A¨Ã¥BŪ¨ú©Ò¦³*.csvÀɮפ¤ªº²Ä5Äæ(close)ªº¸ê®Æ¡A¨Ì§Ç¹ï·ÓÀɦW»P²Ä1Ä椤ªº¥N¸¹±N²Ä5Äæ¸ê®Æ¼g¤J¦U¥N¸¹ªº¦C¦ì¤¤

    ¬õ¦r³¡¤À ½Ðªþ½d¨Ò¤W¨Ó

ªþÀÉ:excel¤¤Sheet2¬°·Q­n¹F¦¨ªº½d¨Ò¡A¿é¤Jªº¸ê®Æ¬°data¸ê®Æ§¨¤¤³¡¤Àªº*.csv
        ¤U¸ü¤U¨Óªº*.csv¡A¥i¯à»PSheet2ªº¥N¸¹¤£¤@­P¡A¦]¬°ºô¸ô¤U¸üªº¸ê®Æ¤£¥þ
        ©Ò¥H·Q­n±q¤U¸ü¤U¨Óªº*.csv»PSheet2¥N¸¹®Ö¹ï«á¡A¨Ã§â©Ò¦³*.csvªº²Ä(Close)Äæ¸ê®ÆÂà¸m¨ìSheet2¤¤¦U¥N¸¹ªº¦C¦ì.

Test.rar (319.53 KB)

TOP

¦^´_ 12# spermbank
°ÝÃD1 : Äæ ©Î ¦C ªº§R°£.  »Ý¥Ñ ¤U©¹¤W  §R°£.  ¥Ñ ¤W©¹¤U  §R°£ ·|¦³º|ºô¤§³½
  1. for i=1 to 10      '¥Ñ ¤W©¹¤U  §R°£
  2. cells(i,1).Delete Shift:=xlUp  
  3. '¨Ò=1 -> ¤U¤èÀx¦s®æ¤W²¾   cells(2,1)·|¤W¤É¬°cells(1,1) º|ºô±¼
  4. '¨Ò=5 -> ¤U¤èÀx¦s®æ¤W²¾   cells(6,1)·|¤W¤É¬°cells(5,1) º|ºô±¼
  5. next
½Æ»s¥N½X

°ÝÃD2: ¦p¦óŪ¨ú¥N¸¹1101.csv²Ä1Äæ©Ò¦³¤é´Á(data)¡A¼g¤Jexcel¤¤ªºsheet2ªº²Ä1¦C¤¤¡A¨Ã¥BŪ¨ú©Ò¦³*.csvÀɮפ¤ªº²Ä5Äæ(close)ªº¸ê®Æ¡A¨Ì§Ç¹ï·ÓÀɦW»P²Ä1Ä椤ªº¥N¸¹±N²Ä5Äæ¸ê®Æ¼g¤J¦U¥N¸¹ªº¦C¦ì¤¤
¬õ¦r³¡¤À ½Ðªþ½d¨Ò¤W¨Ó

TOP

¦^´_ 11# GBKEE

·PÁ¤j¤j¡AÅý§Úªºµ{¦¡¤S¥i¥HÄ~Äò©¹¤U¼g¡C
Ãö©ó®»¾ú¥vªÑ»ù¨S®»¨ìªº³¡¤À¡A¸g¹L¤@µ§¤@µ§ªº¤ñ¹ï¡A½T©w¬Oºô¯¸µL¦¹¸ê®Æ¡C
¥t¡A®»¾ú¥vªÑ»ù¤è­±µ{¦¡¦³ÂI¤£À´¡A¦ý¬OÃö©ó§R°£¦³Ãö"Âd"ªº¦C¦ì
¬°¤°»ò§Ú¨º¼Ë¤lªº¼gªk¤£¦æ©O?

2:¦p¦óŪ¨ú¥N¸¹1101.csv²Ä1Äæ©Ò¦³¤é´Á(data)¡A¼g¤Jexcel¤¤ªºsheet2ªº²Ä1¦C¤¤¡A¨Ã¥BŪ¨ú©Ò¦³*.csvÀɮפ¤ªº²Ä5Äæ(close)ªº¸ê®Æ¡A¨Ì§Ç¹ï·ÓÀɦW»P²Ä1Ä椤ªº¥N¸¹±N²Ä5Äæ¸ê®Æ¼g¤J¦U¥N¸¹ªº¦C¦ì¤¤.
  ¦¹°ÝÃD¦³ª¦¤å´M§ä¬ÛÃö°ÝÃD¸Õ¼g¡A¥i¬OÁÙ¬O¼g¤£¥X¨Ó¡A½Ð¨D¤j¤jÀ°¦£¡C

TOP

        ÀR«ä¦Û¦b : ¡i®É¶¡¦¨´N¤@¤Á¡j®É¶¡¥i¥H³y´N¤H®æ¡A¥i¥H¦¨´N¨Æ·~¡A¤]¥i¥HÀx¿n¥\¼w¡C
ªð¦^¦Cªí ¤W¤@¥DÃD