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

VBA¡@µLªk¦b¤@¯ë¢á¢Ö¢Ö¢Ó¢â¤¤°õ¦æ¡H¡H

VBA¡@µLªk¦b¤@¯ë¢á¢Ö¢Ö¢Ó¢â¤¤°õ¦æ¡H¡H

½Ð°Ý¦U¦ì¤j¤j
¦³µo¥Í¹L¥H¤Uªº±¡§Î¶Ü??
¥H¤Uªþ¤W¹ÏÀɸòµ{¦¡½X

ÁÂÁÂ
  1. Sub R2R_PLOTALL()

  2. Dim x, y, z, R As Integer
  3. Dim CName(10, 10)
  4. R = 0
  5. Do While y = ""                                          '¨¾¤î¸ê®Æ¬°ªÅ¥Õ
  6.    y = Application.InputBox("µe¹Ï¦¸¼Æ", "", 1, 350, 150) '¿é¤J­nµe´X±i¹Ï,¹w³]¬°1±i
  7.    If y = "" Then MsgBox "µe¹Ï¦¸¼Æ¤£±o¬°ªÅ¥Õ!!"
  8. Loop
  9. '----------------------------------¿é¤J¦U¹Ïªí¬ÛÃö¸ê®Æ(©Ò»Ý¸ê®Æ¦Û¦æ¼W¥[)-----------
  10. For z = 1 To y
  11. Do While CName(z, 0) = ""
  12.    CName(z, 0) = Application.InputBox("²Ä" & z & "¹Ï¦W", "", "R2R_CHART." & z, 350, 150) '¿é¤J¹Ïªí¦WºÙ,¹w³]¬°R2R_Ave.G.R.1
  13.    If CName(z, 0) = "" Then MsgBox "½Ð¿é¤J¹Ï¦W!!"
  14. Loop

  15. 'Do While CName(z, 1) = ""
  16.    'CName(z, 1) = Application.InputBox("²Ä" & z & "¹ÏªºY¶b_Scale", "", "0", 350, 150)    '¿é¤Jx¶b³Ì¤p®y¼Ð,¹w³]¬°0
  17.   ' If CName(z, 1) = "" Then MsgBox "Y¶b_Scale¤£±o¬°ªÅ¥Õ!!"
  18. 'Loop '

  19. 'Do While CName(z, 2) = ""
  20.   ' CName(z, 2) = Application.InputBox("²Ä" & z & "¹ÏªºMaximumScale", "", "1000", 350, 150) '¿é¤Jx¶b³Ì¤j®y¼Ð,¹w³]¬°0
  21.    'If CName(z, 2) = "" Then MsgBox "MaximumScale¤£±o¬°ªÅ¥Õ!!"
  22. 'Loop
  23. Next
  24. '---------------------------------------------------------------
  25. For z = 1 To y
  26. Sheets("R2R_analysis").Select
  27. ActiveSheet.Shapes.AddChart.Select
  28. ActiveChart.ChartType = xlXYScatterSmoothNoMarkers
  29. Application.ScreenUpdating = False

  30. For x = 2 To Worksheets.Count
  31.    On Error Resume Next  '''''' ¿ù»~¸õ¹L
  32.    ActiveChart.SeriesCollection.NewSeries
  33.    
  34.    ActiveChart.SeriesCollection(x - 1).Name = Sheets("¤u§@ªí1 (" & x & ")").Range("U1") ''''.Offset(0, (z - 1))
  35.    ActiveChart.SeriesCollection(x - 1).XValues = Sheets("¤u§@ªí1 (" & x & ")").Range("A2:A20000") ''''.Offset(0, (z - 1))
  36.    ActiveChart.SeriesCollection(x - 1).Values = Sheets("¤u§@ªí1 (" & x & ")").Range("D2:D20000").Offset(0, (z - 2))
  37. Next
  38. On Error GoTo 0 '''''''''''''¿ù»~¸õ¹L''''''''
  39. Application.ScreenUpdating = True

  40. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  41. ActiveChart.ApplyLayout (4)

  42. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  43. Dim xRg As Range
  44. Dim xChart As ChartObject
  45. Set xRg = Range("A20:J50").Offset(0, R)
  46. Set xChart = ActiveSheet.ChartObjects(z)
  47. With xChart
  48.    .Top = xRg(z).Top
  49.    .Left = xRg(z).Left
  50.    .Width = xRg.Width
  51.    .Height = xRg.Height
  52. End With

  53. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  54. ActiveChart.SetElement (msoElementChartTitleAboveChart)
  55. Selection.Caption = CName(z, 0)

  56. ActiveChart.SetElement (msoElementPrimaryValueAxisTitleRotated)

  57. For x = 2 To Worksheets.Count
  58. On Error Resume Next  '''''' ¿ù»~¸õ¹L
  59. Selection.Caption = Sheets("¤u§@ªí1 (" & x & ")").Range("C1").Offset(0, (z - 1))       ''''CName(z, 1) ''''''''"G.R.(mm/hr)"
  60. On Error GoTo 0 '''''''''''''¿ù»~¸õ¹L''''''''
  61. Next

  62. ActiveChart.SetElement (msoElementPrimaryCategoryAxisTitleAdjacentToAxis)
  63. Selection.Caption = "Length(mm)"
  64. ActiveSheet.ChartObjects(z).Activate
  65. ActiveChart.Axes(xlCategory).Select
  66. ActiveChart.Axes(xlCategory).MinimumScale = 0 '''''''CName(z, 1)
  67. ActiveChart.Axes(xlCategory).MaximumScale = 1000 '''''CName(z, 2)
  68. ActiveChart.Axes(xlCategory).MajorUnit = 100
  69. ActiveChart.Axes(xlCategory).MinorUnit = 50
  70. ActiveChart.Axes(xlCategory).CrossesAt = 0
  71. ActiveChart.Axes(xlValue).CrossesAt = 0
  72. ActiveChart.SetElement (msoElementPrimaryValueGridLinesMajor)
  73. ActiveChart.SetElement (msoElementPrimaryCategoryGridLinesMajor)
  74. Application.ScreenUpdating = True
  75. R = R + 10 '¨C±i¹Ïªí¦ì¸m¶¡¹j
  76. Next
  77. End Sub
½Æ»s¥N½X
Ian

¦^´_ 1# iverson105

¦]R+¼Æ­È¤£¦N§Q
§âR2R_PLOTALL()§ï±¼À³¸Ó´N¥i¥H

TOP

¦^´_ 2# jcchiang
¥i¥H¥Î¤F
·P¿E¤£ºÉ
ÁÂÁÂ
Ian

TOP

        ÀR«ä¦Û¦b : ¦Û¤v®`¦Û¤v¡A²ö¹L©ó¶ÃµoµÊ®ð¡C
ªð¦^¦Cªí ¤W¤@¥DÃD