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

[µo°Ý] ½Ð°Ý¤é»ù®æ«ç»òÂàÅܦ¨¶g»ù®æ©O?

¦^´_ 2# GBKEE


    ¤£¦n·N«ä,§Ú¥J²Ó¤@¬Ý,³oµ{¦¡½X,¬O§â¨C¶g¤­ªº¶}§C¦¬°ª¨q¥X¨Ó,¨º§Ú·Q§â¶}½L»ù³]¦b¶g¤@,³Ì°ª³Ì§C¬O³o¦b¶g©Ò¥X²{ªº¼Æ­È,¦¬½L·íµM¶g¤­³Ì«áªº»ù®æ,§Ú¦³¬Ý¨ì¹ï©¤¼gªºµ{¦¡½X,¦ý§Ú¤£ª¾¹D­n±q¦Ó§ï°_,½Ðª©¥D¬Ý¬Ý
Sub bwwweek()
¡¥«Ø¥ß·sªº¤u§@ªí, ¦s©ñ©P数Õu
ActiveWorkbook.Sheets.Add after:=Worksheets(1)
Worksheets(1).Activate

¡¥§â²Ä¤@¦æ数Õu¦s¨ì变¶q¡Ahand为¦æ号¡Ah为³Ì°ª¡Al为³Ì§C¡Ac为¦¬盘¡Ad为¤é´Á¡Avol为¦¨¥æªÑ数¡Aamt为¦¨¥æª÷额

Dim hand As Integer, h As Double, l As Double, _
c As Double, d As Date, o As Double, _
vol As Long, amt As Long
hand = 1
d = Worksheets(1).Cells(hand, 1).Value

¡¥¥æ©ö²Ä¤@¤ÑÖÃ开¬P´Á¤­¦³¤L¤Ñ,n5计数¾¹¡Afri储¦s¬P´Á¤­ªº¤é´Á
Dim n5 As Integer, md5 As Date
For n5 = 0 To 4
fri = d + n5
If Weekday(fri) ¡V 1 = 5 Then
Exit For
End If
Next n5

¡¥²Ä¤@©Pªº¦æ数,row1为¥»©P²Ä¤@¥æ©ö¤é¦æ数¡Arow5为¥»©P³Ì¦Z¥æ©ö¤é¦æ数, frim暂储¦s¤@©P内¥æ©ö¤éªº数Õu, ¥Î¤_©M这©Pfri¤é´Á¤ñ较,¤j¤_fri§Y计ºâ¥»©P³Ì¦Z¥æ©ö¤é¦æ数
Dim row1 As Integer, row5 As Integer, frim As Date
row1 = 1

Dim n As Integer
For n = 1 To 6
If frim > fri Then
row5 = n ¡V 1
Exit For
End If
frim = Worksheets(1).Cells((hand + n), 1).Value
Next n

¡¥§â总¦@ªÑ²¼¤éK线­ì©l数Õuªº¦æ数储¦s¦brng变¶q
Dim rng As Integer
rng = Range(¡§A65536¡²).End(xlUp).Row

Dim whand As Integer, wdate As Date
whand = 1
¡¥==========================================================
While row1 <= rng
¡¥¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X
If frim >= fri Or frim = 0 Then

¡¥§â¤@©P开盘,¦¬盘,¶qµ¥¦s¤J变¶q, ¥Î¤_¤U­±写¤J©Pªº·s¤u§@ªí
wopen = Worksheets(1).Cells(row1, 2).Value
whigh = Application.WorksheetFunction.Max(Range(Cells(row1, 3), Cells(row5, 3)))
wlow = Application.WorksheetFunction.Min(Range(Cells(row1, 4), Cells(row5, 4)))
wclose = Worksheets(1).Cells(row5, 5).Value
wdate = Worksheets(1).Cells(row1, 1).Value

hand = row5 + 1

Worksheets(2).Cells(whand, 1).Value = wdate
Worksheets(2).Cells(whand, 2).Value = wopen
Worksheets(2).Cells(whand, 3).Value = whigh
Worksheets(2).Cells(whand, 4).Value = wlow
Worksheets(2).Cells(whand, 5).Value = wclose
whand = whand + 1

End If
¡¥¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X-
If hand <= rng And frim <> 0 Then

frim = Worksheets(1).Cells(hand, 1).Value
¡¥-  -  -  -  -  -  -
For n5 = 0 To 4
fri = frim + n5

If Weekday(fri) ¡V 1 = 5 Then
Exit For
End If
Next n5
¡¥-  -  -  -  -  -  -

row1 = row5 + 1
¡¥///////////////////////////////////////////////////
For n = 1 To 6
If frim > fri Or frim = 0 Then
row5 = row5 + n ¡V 1
Exit For
End If
frim = Worksheets(1).Cells((hand + n), 1).Value
Next n
¡¥//////////////////////////////////////////////////
Else
row1 = row5 + 1
End If
¡¥¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡X¡V
Wend
¡¥===================================================
End Sub

TOP

¦^´_ 2# GBKEE
·PÁª©¥Dªº¸Ñµª,³z¹Lª©¥Dªºµ{¦¡½X,¥u­n§â"WW"Åܦ¨"m"´N·|Åܦ¨¤ë»ù®æÅo!

TOP

¦^´_ 1# jovi0801
¸Õ¸Õ¬Ý
  1. Sub Ex() 'DatePart("WW", .Rows(xi).Cells(1))  ¶Ç¦^²Ä´X¶g
  2.     Dim Rng As Range, xi As Integer
  3.     With Sheets("¤é»ù®æ").Range("A1").CurrentRegion.Rows
  4.         Set Rng = .Rows(1)
  5.         xi = 2
  6.         Do
  7.             If DatePart("WW", .Rows(xi).Cells(1)) <> DatePart("WW", .Rows(xi + 1).Cells(1)) Then Set Rng = Union(Rng, .Rows(xi))
  8.             xi = xi + 1
  9.            If xi = .Rows.Count Then Set Rng = Union(Rng, .Rows(xi))
  10.         Loop While xi < .Rows.Count
  11.     End With
  12.     With Sheets("©P»ù®æ")
  13.         .UsedRange.Clear
  14.         Rng.Copy .[a1]
  15.     End With
  16. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : ¤@¥y·Å·xªº¸Ü¡A´N¹³©¹§O¤H¨­¤WÅx­»¤ô¡A¦Û¤v·|ªg¨ì¨â¤Tºw¡C
ªð¦^¦Cªí ¤W¤@¥DÃD