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

[µo°Ý] ½Ð°Ý¸Ó¦p¦ó¥ÎVBA¦Û°Ê¤Æ¥XªÑ²¼K½u¹Ï©O¡H

¦^´_ 1# j1221
¥ý§ïÅܸê®Æ¼Æ¦C¦A³]©w¹ÏªíÃþ«¬
  1. Sub Macro1()
  2. '
  3. ' Macro1 Macro
  4. ' Shih-Hao ¦b 2011/1/16 ¿ý»sªº¥¨¶°
  5. '

  6. '
  7.     Charts.Add
  8.     'ActiveChart.ChartType = xlStockOHLC  '¨ú®ø³o¦æ

  9.     ActiveChart.SetSourceData Source:=Sheets("76C").Range("A1:N22"), PlotBy:= _
  10.         xlColumns
  11.     ActiveChart.SeriesCollection(5).Delete
  12.     ActiveChart.SeriesCollection(5).Delete
  13.     ActiveChart.SeriesCollection(5).Delete
  14.     ActiveChart.SeriesCollection(5).Delete
  15.     ActiveChart.SeriesCollection(5).Delete
  16.     ActiveChart.SeriesCollection(1).XValues = "='76C'!R2C1:R22C1"
  17.     ActiveChart.SeriesCollection(2).XValues = "='76C'!R2C1:R22C1"
  18.     ActiveChart.SeriesCollection(3).XValues = "='76C'!R2C1:R22C1"
  19.     ActiveChart.SeriesCollection(4).XValues = "='76C'!R2C1:R22C1"
  20.     ActiveChart.Location Where:=xlLocationAsObject, Name:="76C"
  21.     With ActiveChart
  22.         .HasTitle = False
  23.         .Axes(xlCategory, xlPrimary).HasTitle = False
  24.         .Axes(xlValue, xlPrimary).HasTitle = False
  25.         .ChartType = xlStockOHLC   '³o¸Ì¤~§ïÅÜÃþ«¬
  26.     End With
  27.     ActiveChart.HasLegend = False
  28.     Windows("test1.xls").SmallScroll Down:=7
  29.     ActiveSheet.Shapes(1).IncrementLeft -168.75
  30.     ActiveSheet.Shapes(1).IncrementTop 269.25
  31.     Windows("test1.xls").SmallScroll Down:=6
  32.     ActiveSheet.Shapes(1).ScaleWidth 1.53, msoFalse, msoScaleFromTopLeft
  33.     ActiveSheet.Shapes(1).ScaleHeight 1.36, msoFalse, msoScaleFromTopLeft
  34.     ActiveChart.PlotArea.Select
  35.     With Selection.Border
  36.         .ColorIndex = 16
  37.         .Weight = xlThin
  38.         .LineStyle = xlContinuous
  39.     End With
  40.     With Selection.Interior
  41.         .ColorIndex = 2
  42.         .PatternColorIndex = 1
  43.         .Pattern = xlSolid
  44.     End With
  45.     With Selection.Border
  46.         .ColorIndex = 16
  47.         .Weight = xlThin
  48.         .LineStyle = xlContinuous
  49.     End With
  50.     With Selection.Interior
  51.         .ColorIndex = 40
  52.         .PatternColorIndex = 1
  53.         .Pattern = xlSolid
  54.     End With
  55.     ActiveChart.Axes(xlCategory).Select
  56.     Selection.TickLabels.NumberFormatLocal = "yyyy-mm-dd"

  57. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 4# j1221


    k½u¹Ï¸ê®Æ¥²»Ý¨Ì§Ç±Æ¦C
§A­Yª½±µ¥Î©Ò¦³Äæ¦ìª½±µ»s¹Ï·|¥H¹w³]ªºª½½Õ¹Ï§e²{
­Yª½±µÂà´«Ãþ«¬¡AEXCEL¤]·|¥X²{ĵ§iµøµ¡¡A­n¨DÅܧó¸ê®Æ½d³ò
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 6# j1221


    Sheets(c & op).Cells(i, 1).PasteSpecial
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 8# j1221


    ActiveChart.SeriesCollection(1).XValues = "='" & c & op & "'!R2C1:R22C1"
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 10# j1221
À³¸Ó¬OSELECTªº°ÝÃD
  1.     With Sheets("data")
  2.                 .Cells(1, 1).EntireRow.Copy
  3.                 Sheets.Add After:=Sheets("data")
  4.                 ActiveSheet.Cells(1, 1).PasteSpecial
  5.                 ThisWorkbook.ActiveSheet.Name = c & op
  6.    End With
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 13# j1221


    Sheets("data").Cells(i, 3).Value = Val(f)
¦]¬°inputbox¦ì«ü©wÅܼƫ¬ºA«h·|¥H¦r¦ê§ÎºAÀq»{
©Ò¥Hf¬O¤@­Ó¼Æ¦r²Õ¦Xªº¦r¦ê
¦ý¬O¡A§A¤u§@ªíªº¦~¤ë¬O³q¥Î®æ¦¡¡A©Ò¥H³Q»{¬°¬O¼Æ値
©Ò¥H§PÂ_¦¡¼Æª½¬O¤£¥i¯à¸ò¦r¦ê¬Ûµ¥
¬G¦¹±Nf¨Ï¥ÎVAL¨ç¼ÆÂର¼Æ­È§Y¥i
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

        ÀR«ä¦Û¦b : «H¤ß¡B¼Ý¤O¡B«i®ð¤TªÌ¨ã³Æ¡A«h¤Ñ¤U¨S¦³°µ¤£¦¨ªº¨Æ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD