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

[µo°Ý] ¸ê®Æ±Æ§Ç¤ÏÂà

[µo°Ý] ¸ê®Æ±Æ§Ç¤ÏÂà

³o¬O¥Î¥¨¶°¿ýªº¸ê®Æ±Æ§Ç¤ÏÂà
½Ð°Ý¦³Â²³æªº¼gªk
¦p¦ó¸Ñ°£Âê©w¤u§@¦C

ÁÂÁÂ

IsSort.rar (648.38 KB)

¥»©«³Ì«á¥Ñ wufonna ©ó 2013-10-5 10:22 ½s¿è

¤S½Ð°Ý§Ú·Qµe¥Xªe¬y¹Ï¡A°Ñ¦Ò c_c_lai ¤jªº
http://forum.twbts.com/thread-6531-1-1.html
¦p¦ó¿ù»~¡AÁÂÁÂ
2013-10-05_101137.jpg

IsSort2.rar (658.3 KB)

TOP

¦^´_ 2# wufonna
¸Õ¸Õ¬Ý¡I
01.png
2013-10-5 15:00

IsSort2.rar (817.56 KB)
¸Ñ¨M¤èªk¦p¤U¡G
1.  .SetSourceData Source:=Range("data!$A$4:data!$A$" & totalRows & ", data!$B$4:data!$E$" & totalRows)
     ¥X²{¿ù»~°T®§¡F ¦ý¤£¤©²z·|¡A¨ä°ÝÃD¬O¦] totalRows ­È = 3075 (¶W¥X 255) ©Ò¤Þµo¡C
2.  ¦b ActiveSheet.Shapes.AddChart.Select ¤W¤@¦æ¡A ¬G·N¸É¤W¤@¦æ¡G (¿é¤J)
     totalRows = 100
     µM«á¡B¦A­«·s°õ¦æ drawCharts()¡A «Ý¥¿±`ø¥X¹Ïªí«á¦A±N totalRows = 100 ¨º¤@¦æ§R°£±¼¡A¦A°õ¦æ drawCharts¡A
     ¤§«á«K¤@¤Á OK ¸Ñ¨M¤F¡C¦Ü©ó¬°¦ó·|¥X²{¦¹¿ù»~°T®§¡A¥i¯à­n½Ð±Ð¦U¦ì«e½å¤F¡I
3.  ¯¬¶¶·N¡I

TOP

ÁÂÁÂ c_c_lai  ¤j¤j
³o¬O§ï¹LªºÀÉ®×

½Ð°Ý¦p¦ó¥[¤JÁaªº®æ½u¡A¤U­±ªº¤é´ÁÅã¥Ü´X¦~¤@¤ë¡AÁôÂüƦC1 ¼Æ¦C2 ¼Æ¦C3 ¼Æ¦C4
6,783.3 §ï¦¨ ²Ä¥|¦Cªº 1.12 1.09 1.06 1.03 1 0.97 0.94 0.91 0.88
¦p¤U­±ªº¹Ï¨Ò¡AÁÂÁÂ

¤U­±ªº vba ¦³Â²³æªº¼gªk¶Ü

'¨ú±o¹Ïªíªº³Ì¤j¡B³Ì¤p­È
Sub GetMinMax()
    With Sheets("data")
        Dim VMin As Single, VMax As Single
        Dim VIMin As Single, VIMax As Single
        Dim i As Integer
        
        
        
        VMin = .Cells(5, 9).Value
        VMax = .Cells(5, 9).Value
        
        'Debug.Print "VMin =" & VMin
        'Debug.Print "VMax =" & VMax
            For i = 5 To .Range("I" & .Rows.Count).End(xlUp).Row
                If .Cells(i, 9).Value < VMin Then
                    VMin = .Cells(i, 9).Value
'                    Debug.Print "VMin =" & VMin
'                    Debug.Print i
                    GoTo NNN
                End If
               
                If .Cells(i, 9).Value > VMax Then
                    VMax = .Cells(i, 9).Value
'                    Debug.Print "VMax =" & VMax
'                    Debug.Print i
                End If
NNN:
            
            Next
'        Debug.Print "VMin =" & VMin
'        Debug.Print "VMax =" & VMax
        VIMin = Int(VMin * 0.88 / 1000) * 1000
        VIMax = Int(VMax * 1.12 / 1000) * 1000 + 1000
'        Debug.Print VIMin
'        Debug.Print VIMax
   
   
    End With
End Sub

¹Ï¨ÒªºªÑ»ù³Ì¤p VIMin¡A³Ì¤j­È VIMax vba ¦p¦ó ¼g ÁÂÁÂ
Mychart.gif

IsSort2.rar (902.69 KB)

TOP

¥»©«³Ì«á¥Ñ stillfish00 ©ó 2013-10-9 16:00 ½s¿è

¦^´_ 4# wufonna
¤U­±ªº vba ¦³Â²³æªº¼gªk¶Ü
  1.     With Sheets("data")
  2.       VIMin = Int(Application.WorksheetFunction.Min(.Range(.[I5], .[I5].End(xlDown))) * 0.88 / 1000) * 1000
  3.       VIMax = Int(Application.WorksheetFunction.Max(.Range(.[I5], .[I5].End(xlDown))) * 1.12 / 1000) * 1000 + 1000
  4.     End With
½Æ»s¥N½X

TOP

ÁÂÁÂ stillfish00  ¤j¤j
¤p§Ì¹ïvba¹Ïªíªº«ü¥O/__\
¹Ï¦n¹³¨S§@¥Î¡A¤£ª¾«ü¥O¤U¦b¨º


Option Explicit

Sub drawCharts()
    Dim toindexRows As Single, totalRows As Single, totalRows2 As Single

    Dim xRow, yCol, cHeight, cWidth As Integer
    Dim text As String
    Dim chartname As String
    Dim sRowHeight As Single
    Dim VIMin As Single, VIMax As Single
    xRow = 3
    yCol = 1
    cHeight = 31         'CHeight ©w¸q¬°¹Ïªí©Ò¦ûªº¦C°ª
    cWidth = 874

    With Sheets("data")
      VIMin = Int(Application.WorksheetFunction.Min(.Range(.[I5], .[I5].End(xlDown))) * 0.88 / 1000) * 1000
      VIMax = Int(Application.WorksheetFunction.Max(.Range(.[I5], .[I5].End(xlDown))) * 1.12 / 1000) * 1000 + 1000
    End With
   
    Sheets("chart").Select

   ActiveSheet.ChartObjects.Delete
    toindexRows = Sheets("data").Range("I" & Rows.Count).End(xlUp).Row - 1100      '¬ù¨ú¤T¦~¸ê®Æ
    totalRows = Sheets("data").Range("A" & Rows.Count).End(xlUp).Row     ' ¶Ç¦^ B Äæ©Ò¨Ï¥ÎÀx¦s®æ¤§³Ì«á¤@®æ¤§¦C¸¹
      totalRows2 = Sheets("data").Range("I" & Rows.Count).End(xlUp).Row     ' ¶Ç¦^ I Äæ©Ò¨Ï¥ÎÀx¦s®æ¤§³Ì«á¤@®æ¤§¦C¸¹
'    '¥ý§â¦C°ª§ä¥X¨Ó, ¤~¦nºâ¥X¹Ï­n¦û´X¦C, ¨â­Ó¹Ï¤~¦n³s¦b¤@°_
'    sRowHeight = Sheets("data").Rows(3).RowHeight

    ActiveSheet.Shapes.AddChart.Select
    With ActiveChart
        .SetSourceData Source:=Range("data!$A$" & toindexRows & ":data!$A$" & totalRows2 & ", data!$B$" & toindexRows & ":data!$E$" & totalRows2)
Debug.Print totalRows
        .ChartType = xlStockOHLC
        With .ChartGroups(1)
             .AxisGroup = 1
             ' .UpBars.Format.Fill.ForeColor.RGB = RGB(255, 0, 0)           ' ¬õ¦â
             .UpBars.Format.Fill.ForeColor.RGB = RGB(255, 69, 0)          ' ¾ï¬õ¦â
             ' .DownBars.Format.Fill.ForeColor.RGB = RGB(0, 32, 96)       ' ²`ÂŦâ
             .DownBars.Format.Fill.ForeColor.RGB = RGB(0, 250, 170)     ' ²L¬vºñ¦â
        End With

            .SeriesCollection.Add Source:=Range("data!$J$" & toindexRows & ":data!$R$" & totalRows2)
'             .SeriesCollection.Add Source:=Range("data!$J$" & toindexRows & ":data!$R$" & totalRows)

Debug.Print totalRows


        With .SeriesCollection(5)
            .Name = "=data!$J$" & toindexRows
            .ChartType = xlLine
            With .Format.Line
                .Visible = msoTrue          ' ¥D¤O¬É¤J
                ' .ForeColor.RGB = RGB(105, 205, 170)      ' ¥D¤O¬É¤J«ü¼ÆÅã¥Ü¤§ÃC¦â    ---   Âźñ¦â
                .ForeColor.RGB = RGB(32, 178, 170)         ' ¥D¤O¬É¤J«ü¼ÆÅã¥Ü¤§ÃC¦â    ---   ®ü¬vºñ¦â
                .Transparency = 0
                .Weight = 1                             '½u±ø¼e«×
            End With
        End With

        With .SeriesCollection(6)
            .Name = "=data!$J$" & toindexRows
            .ChartType = xlLine
            With .Format.Line
                .Visible = msoTrue          ' ¥D¤O¬É¤J
                ' .ForeColor.RGB = RGB(105, 205, 170)      ' ¥D¤O¬É¤J«ü¼ÆÅã¥Ü¤§ÃC¦â    ---   Âźñ¦â
                .ForeColor.RGB = RGB(32, 178, 160)         ' ¥D¤O¬É¤J«ü¼ÆÅã¥Ü¤§ÃC¦â    ---   ®ü¬vºñ¦â
                .Transparency = 0
                .Weight = 1                             '½u±ø¼e«×
            End With
        End With

        With .SeriesCollection(7)
            .Name = "=data!$J$" & toindexRows
            .ChartType = xlLine
            With .Format.Line
                .Visible = msoTrue          ' ¥D¤O¬É¤J
                ' .ForeColor.RGB = RGB(105, 205, 170)      ' ¥D¤O¬É¤J«ü¼ÆÅã¥Ü¤§ÃC¦â    ---   Âźñ¦â
                .ForeColor.RGB = RGB(32, 178, 150)         ' ¥D¤O¬É¤J«ü¼ÆÅã¥Ü¤§ÃC¦â    ---   ®ü¬vºñ¦â
                .Transparency = 0
                .Weight = 1                             '½u±ø¼e«×
            End With
        End With

        With .SeriesCollection(8)
            .Name = "=data!$J$" & toindexRows
            .ChartType = xlLine
            With .Format.Line
                .Visible = msoTrue          ' ¥D¤O¬É¤J
                ' .ForeColor.RGB = RGB(105, 205, 170)      ' ¥D¤O¬É¤J«ü¼ÆÅã¥Ü¤§ÃC¦â    ---   Âźñ¦â
                .ForeColor.RGB = RGB(32, 178, 140)         ' ¥D¤O¬É¤J«ü¼ÆÅã¥Ü¤§ÃC¦â    ---   ®ü¬vºñ¦â
                .Transparency = 0
                .Weight = 1                             '½u±ø¼e«×
            End With
        End With
                With .SeriesCollection(9)
            .Name = "=data!$J$" & toindexRows
            .ChartType = xlLine
            With .Format.Line
                .Visible = msoTrue          ' ¥D¤O¬É¤J
                ' .ForeColor.RGB = RGB(105, 205, 170)      ' ¥D¤O¬É¤J«ü¼ÆÅã¥Ü¤§ÃC¦â    ---   Âźñ¦â
                .ForeColor.RGB = RGB(32, 178, 130)         ' ¥D¤O¬É¤J«ü¼ÆÅã¥Ü¤§ÃC¦â    ---   ®ü¬vºñ¦â
                .Transparency = 0
                .Weight = 1                             '½u±ø¼e«×
            End With
        End With

        With .SeriesCollection(10)
            .Name = "=data!$J$" & toindexRows
            .ChartType = xlLine
            With .Format.Line
                .Visible = msoTrue          ' ¥D¤O¬É¤J
                ' .ForeColor.RGB = RGB(105, 205, 170)      ' ¥D¤O¬É¤J«ü¼ÆÅã¥Ü¤§ÃC¦â    ---   Âźñ¦â
                .ForeColor.RGB = RGB(32, 178, 120)         ' ¥D¤O¬É¤J«ü¼ÆÅã¥Ü¤§ÃC¦â    ---   ®ü¬vºñ¦â
                .Transparency = 0
                .Weight = 1                             '½u±ø¼e«×
            End With
        End With
                With .SeriesCollection(11)
            .Name = "=data!$J$" & toindexRows
            .ChartType = xlLine
            With .Format.Line
                .Visible = msoTrue          ' ¥D¤O¬É¤J
                ' .ForeColor.RGB = RGB(105, 205, 170)      ' ¥D¤O¬É¤J«ü¼ÆÅã¥Ü¤§ÃC¦â    ---   Âźñ¦â
                .ForeColor.RGB = RGB(32, 178, 110)         ' ¥D¤O¬É¤J«ü¼ÆÅã¥Ü¤§ÃC¦â    ---   ®ü¬vºñ¦â
                .Transparency = 0
                .Weight = 1                             '½u±ø¼e«×
            End With
        End With

        With .SeriesCollection(12)
            .Name = "=data!$J$" & toindexRows
            .ChartType = xlLine
            With .Format.Line
                .Visible = msoTrue          ' ¥D¤O¬É¤J
                ' .ForeColor.RGB = RGB(105, 205, 170)      ' ¥D¤O¬É¤J«ü¼ÆÅã¥Ü¤§ÃC¦â    ---   Âźñ¦â
                .ForeColor.RGB = RGB(32, 178, 100)         ' ¥D¤O¬É¤J«ü¼ÆÅã¥Ü¤§ÃC¦â    ---   ®ü¬vºñ¦â
                .Transparency = 0
                .Weight = 1                             '½u±ø¼e«×
            End With
        End With
                With .SeriesCollection(13)
            .Name = "=data!$J$" & toindexRows
            .ChartType = xlLine
            With .Format.Line
                .Visible = msoTrue          ' ¥D¤O¬É¤J
                ' .ForeColor.RGB = RGB(105, 205, 170)      ' ¥D¤O¬É¤J«ü¼ÆÅã¥Ü¤§ÃC¦â    ---   Âźñ¦â
                .ForeColor.RGB = RGB(32, 178, 180)         ' ¥D¤O¬É¤J«ü¼ÆÅã¥Ü¤§ÃC¦â    ---   ®ü¬vºñ¦â
                .Transparency = 0
                .Weight = 1                             '½u±ø¼e«×
            End With
        End With
'        .Axes(xlValue).TickLabels.NumberFormatLocal = "0_ "
        
        With .Axes(xlCategory)                            ' X®y¼Ð¶b (®É¶¡¶b)
'            .CategoryType = xlCategoryScale
'            .TickLabels.NumberFormatLocal = "hh:mm"
'            .MajorTickMark = xlNone
'            .Border.Weight = xlHairline
'            .Border.LineStyle = xlNone
'            .TickLabelPosition = xlLow
'            .TickLabels.Font.Size = 10
         .MaximumScale = VIMax
         .MinimumScale = VIMin

        End With

'        .ChartArea.Height = cHeight * sRowHeight                           ' ±N­ì¥»³]©w¤§°ª«×½Õ¦Ü¾A«×¦ì¸m
'        .ChartArea.Width = cWidth
'
'        text = "ªÑ²¼¹Ï K ½u¡B¥D¤O¡B´²¤á¡B»P¦¨¥æ¶q"
'
'        .SetElement (msoElementChartTitleCenteredOverlay)
'        .ChartTitle.text = text
'        .ChartTitle.Format.TextFrame2.TextRange.Font.Size = 14
'        .Legend.Position = xlCorner                         ' ±N¹Ïªí¹Ï¥Ü±q¹Ïªí³Ì¤U¤è½Õ¾ã¨ì¹Ïªí¤§¥k¤W¨¤¦ì¸m
    End With

    chartname = Trim(Replace(ActiveChart.Name, ActiveSheet.Name, ""))
    ActiveSheet.Shapes(chartname).Left = Cells(xRow, yCol).Left     ' ³]©w¦¹¹Ïªí¹ê»ÚÂ\©ñªº X¡BY ®y¼Ð¦ì¸m¡C
    ActiveSheet.Shapes(chartname).Top = Cells(xRow, yCol).Top

    Range("A1").Select
'Debug.Print Sheets("data").Range("A" & Rows.Count).End(xlUp).Row
'Debug.Print Sheets("data").Range("I" & Rows.Count).End(xlUp).Row
Debug.Print toindexRows
End Sub

TOP

¦^´_ 6# wufonna
¦^´_·í¨ÆªÌ®É¡A½ÐÂI«ö "¦^´_" ¿ï¶s¡A§_ªÌ·í¨Æ¤H¬OµLªk±oª¾
§A¬O§_µªÂЦ^À³¡A³o¤]¬O¤@ºØ§»ª»P´L­«¡C
§Aªº°ÝÃD¬O§_¦p¹Ï¡H
01.png
2013-10-10 07:56

TOP

¦^´_ 7# c_c_lai


ÁÂÁÂ c_c_lai  ¤j
¬Q¤Ñ¬d¤F¤@±ß¡A²M·¡¤F¤@¨Ç VBA

ÁÙ¦³°ÝÃD½Ð±Ð¤j¤j

§Ú§â¥D½u¹Ïªº
        .SeriesCollection(1).Name = ""    ' ¶}½L»ù
        .SeriesCollection(2).Name = ""    ' ³Ì°ª»ù
        .SeriesCollection(3).Name = ""    ' ³Ì§C»ù
        .SeriesCollection(4).Name = ""    ' ¦¬½L»ù (¦¨¥æ»ù)
®³±¼¡A«e¦³¤@­ÓªÅ®æ(¦p¹Ï)¡A½Ð°Ý ¤j¤j¥i§_½Õ¨ì¤¤¶¡¨Ó¡AÁÂÁÂ
Mychart.GIF

¥xÆW¥[Åv«ü¼Æ-³ø¹S²v°Ï¶¡¹Ï..rar (904.73 KB)

TOP

¦^´_ 8# wufonna
.HasLegend = ¤£¬O True ¡A «K¬O False
¸Õ¹Lªºµ²ªG¬OµLªk±N¨ä¤¤¥ô¤@ªº Legent ¦ì¸m²¾¶}¡C

TOP

¦^´_ 9# c_c_lai


    ÁÂÁ ¤j¤j §Ú±q¤¤±o¨ì¤£¤Öª¾ÃÑ¡A
§Ú¬ã¨s¦nÂ^¨ú¾ú¥vªÑ»ù
¦A½Ð±Ð¤j¤j
^0^

TOP

        ÀR«ä¦Û¦b : ¤f»¡¦n¸Ü¡B¤ß·Q¦n·N¡B¨­¦æ¦n¨Æ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD