管理図作成マニュアル(案)
益永八尋Ⅰ.プログラムの概要
品質管理において必要な QC7 道具の一つである管理図作成のプログラムを作成した。 このプログラムは、下記の管理図を作成するものである。 ① BerX-R 管理図 ②Me 管理図 ③X 管理図 ④np 管理図 ⑤p管理図 ⑥c 管理図 ⑦u 管理図 プログラム作成に使用した文献は『[新版]QC 入門講座 7 管理図の作り方と活用』(日 本規格協会)である。 プログラムで使用しているシートは以下のとおりであり、データ入力と出力は同じシ ートでおこなっている。管理図は、別シートで作成するようになっている。管理図は、 自動的に作成されるが、図の書式等は手作業により行うものとしている。 本プログラムの機能は、管理図の作成以外にいくつかの機能をもたせています。それ ぞれの機能はボタンをクリックすることで実行します。 ボタンの名称 機能の説明 備 考 計算の実行 入力されたデータにより平均値、UCL、 LCL 等の各種計算をおこなう。 管 理 図 の 作 成 は 行 わない。 データファイル保存 “様式”+“番号”+”-1“のシートに示 される様式の保存をおこなう。保存形式 は Text 形式です。ファイル名は利用者 が付けたファイル名に管理図名と日付 が付加されます。 データファイル読み 込み 保存されたデータファイルを読み込む 保存ファイル削除 保存されている Text ファイルを削除し ます。 管理図作成 【計算の実行】ボタンをクリックしてか ら実行するボタンで、管理図を作成しま す。 表1 機能表番号 シート名 内 容 1 管理図の概要 管理図の種類、データ等の説明 2 管理限界の係数 管理限界線を求める係数表 3 管理図の選定 管理図の選定方法をしめす。 4 様式1-1 BerX-R 管理図作成のデータ入力・出力 5 様式1-2 BerX-R 管理図の出力 6 様式2-1 p管理図の作成データ入力・出力 7 様式2-2 p管理図の出力 8 様式3-1 Me 管理図作成のデータ入力・出力 9 様式3-2 Me 管理図の出力 10 様式4-1 np 管理図作成のデータ入力・出力 11 様式4-2 np 管理図の出力 12 様式5-1 C 管理図作成のデータ入力・出力 13 様式5-2 C 管理図の出力 14 様式6-1 U 管理図作成のデータ入力・出力 15 様式6-2 U 管理図図の出力 管理図の名称 入出力シート名 管理図出力シート名 BerX-R 管理図 様式1-1 様式1-2 Me 管理図 様式3-1 様式3-2 X 管理図 該当なし 該当なし np 管理図 様式4-1 様式4-2 p 管理図 様式2-1 様式2-2 C 管理図 様式5-1 様式5-2 U 管理図 様式6-1 様式6-2 本プログラムは Excel 2010 14.0,6126,50023(64bit)で作成されているため、他の Version での使用ではバグがでる可能性があります。特に、グラフ作成の部分での発生が あります。このため、本プログラムを他のVersion で使用する場合はプログラムコードの 変更が必要です。プログラムコードは保護されているため、利用者が直接変更すること はできません。利用者が直接変更したい場合は開発者に連絡をしてください。条件によ っては、プロテクト解除するための暗唱番号(パスワード)をお知らせします。 表2 シート名と内容 表3 管理図とシート名
開発者:益永八尋 連絡先:電子メールアドレス:yahiro_mas@hb.tp1.jp
Ⅱ.入力・出力画面
管理図作成の入力・出力画面を図Ⅱ-1~Ⅱ-6 に示す。データ入力のセルは の セルのみです。データ入力欄は標準の様式(QC 入門講座 7 日本規格協会)を使用してい ます。データ入力個数が多い場合にも対応していますので、実用上は問題なく使用できる ものと考えている。Ⅲ.管理図
150.240 155.240 160.240 165.240 170.240 175.240 0 5 10 15 20 25 観測値 群番号BerX管理図
UCL=171.16 LCL=15 BerX=163.2 2013/08/13 益永八尋 -0.830002 4.1699982 9.1699982 14.169998 19.169998 24.169998 29.169998 34.169998 0 5 10 15 20 25 観測値 群番号BerR管理図
UCL=29.17 BerR=13.8 2013/08/13 益永八尋 図Ⅲ-1 BerX-R 管理図(1/2) 図Ⅲ-1 BerX-R 管理図(2/2)0.000 0.500 1.000 1.500 2.000 2.500 0 5 10 15 20 25 30 観測値 群番号
p管理図
p UCL LCL 中心線 p=0.98 2013/08/13 益永八尋 148.1 153.1 158.1 163.1 168.1 173.1 0 5 10 15 20 25 観測値 群番号Me管理図
Me UCL LCL 中心線 UCL=172.18 LCL=15 Me=162.65 2013/08/13 益永八尋 図Ⅲ-2 p 管理図 図Ⅲ-3 Me 管理図(1/2)0 5 10 15 20 25 30 0 5 10 15 20 25 観測値 群番号
R管理図
UCL=29.173 R=13.8 2013/08/13 益永八尋 0 2 4 6 8 10 0 10 20 30 40 50 観測値 群番号np管理図
np UCL LCL 中心線 UCL=6.7973 np=2.28 2013/08/13 益永八尋 図Ⅲ-3 Me 管理図(2/2) 図Ⅲ-4 np 管理図0 2 4 6 8 10 12 0 5 10 15 20 25 30 35 観測値 群番号
c管理図
c UCL LCL 中心線 UCL=8.7497 BerC=3.3 2013/08/13 益永八尋 0 2 4 6 8 10 0 5 10 15 20 25 観測値 群番号u管理図
u UCL LCL 中心線 BerU=3.68 2013/08/13 益永八尋 図Ⅲ-5 c 管理図 図Ⅲ-6 u 管理図Ⅳ.プログラムの構成
1. モジュール構成
本プログラムのモジュール構成は図Ⅳ-1 に示すとおりである。 Objects 名 Sheet1(管理図の概要) Sheet3(管理限界の係数) Sheet4(管理図の選定)Sheet6(様式 1-1) Sub CommandButton1_Click() ~ Sub CommandButton5_Click() Sheet7(様式 1-2) 同上 Sheet8(様式 2-1) 同上 Sheet9(様式 2-1) 同上 Sheet10(様式 3-1) 同上 Sheet11(様式 3-2) 同上 Sheet12(様式 4-1) 同上 Sheet13(様式 4-2) 同上 Sheet14(様式 5-1) 同上 Sheet15(様式 5-2) 同上 Sheet16(様式 6-1) 同上 Sheet17(様式 6-2) 同上
標準モジュール Module1 Sub Keisan()
Sub Calc_Median() Function
Data_Sort(SelectMethod As String, n As Integer, Mas() As Single)
Function Max_Data(n As Integer, DataX() As Single)
Function Min_Data(n As Integer, DataX() As Single)
Module2 Public X(50, 25) As Single
Sheet_Name As String Public strRange(8, 2)
Sub Main() 'Ber_X-R 管理図 Function Data_Max(N1, N2 As Integer)
Function Data_Min(N1, N2 As Integer)
Module3 Sub Main() 'Me 管理図
Function Data_Sort(N1, N2)
Module4 Sub Main() 'C 管理図
Module5 Sub Main() 'np 管理図
Module6 Sub Main() 'u 管理図
Module7 Sub Main() 'p 管理図
Module8 Sub Kanrizu_Sakusei(strDrafter
As String, Hiduke As String, Kanrizu_Name As String, DMin As Single, DMax As Single, MG As Integer, _
UCL As Single, LCL As Single, BerX As Single)
Module9 Sub
Kanrizu_Sakusei_B(strDrafter As String, Hiduke As String, Kanrizu_Name As String, DMin As Single, DMax As Single, MG As Integer, _
UCL As Single, LCL As Single, BerX As Single)
このコードはグラフ作成部のコードで、Module9 に記述されている。
Sub Kanrizu_Sakusei_B(strDrafter As String, Hiduke As String, Kanrizu_Name As String, DMin As Single, DMax As Single, MG As Integer, _
UCL As Single, LCL As Single, BerX As Single) 'Sub Kanrizu_Sakusei の改良版 2013.8.13 'strDrafter :作成者(異常兆候の判定者) 'Hiduke :作成日付 'Kanrizu_Name :管理図の名称(Ver_X、Me、np、c、u 管理図) 'DMin :観測値の表示値(最小値) 'DMax :観測値の表示値(最大値) 'MG :観測値のある最後の行番号(=観測データ数 Dn+24) 'UCL :管理限界線(上限値) 'LCL :管理限界線(下限値) 'BerX :中心線 '--- Dim strName As String 'グラフ名
Dim n As Integer 'グラフのインデックス番号または表示されて いるグラフの個数
'--- '作図データ範囲の変数名
'Dim strRange(8, 2) As String '系列のデータ範囲 '---
'On Error GoTo errorHandler '管理図作成 'Sheets("Sheet1").Select '****************************************************************************** Sheets(Sheet_Name).Activate ActiveSheet.Shapes.AddChart.Select ActiveChart.ChartType = xlXYScatterLines '****************************************************************************** 'Excel2010 32bit マシンでのコードでは下記のようになる
'ActiveChart.SetSourceData Source:=Range(Shet_Name & "!$B$15:$C$" & MG)
'****************************************************************************** 'Excel2010 14.0,6126,5003 64bit マシンでのコードでは下記のようになる
Select Case Kanrizu_Name Case "BerX 管理図"
ActiveChart.SetSourceData Source:=Range("'" & Sheet_Name & "'!$B$15:$C$" & MG)
Case "BerR 管理図"
ActiveChart.SetSourceData Source:=Range("'" & Sheet_Name & "'!$B$15:$D$" & MG)
Case Else
ActiveChart.SetSourceData Source:=Range("'" & Sheet_Name & "'!$B$15:$C$" & MG) End Select '*************************************************** 'ActiveSheet.ChartObjects(Sheet_Name).Activate ActiveChart.PlotArea.Select '--- '系列 1
ActiveChart.SeriesCollection(1).XValues = "='" & Sheet_Name & "'!" & strRange(1, 1)
ActiveChart.SeriesCollection(1).Values = "='" & Sheet_Name & "'!" & strRange(1, 2) '---
'系列 2(UCL 管理限界線)
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(2).XValues = "='" & Sheet_Name & "'!" & strRange(2, 1)
ActiveChart.SeriesCollection(2).Values = "=’" & Sheet_Name & "'!" & strRange(2, 2) '---
'系列 3(UCL から 1σ下の線)
'ActiveChart.SeriesCollection.NewSeries
'ActiveChart.SeriesCollection(3).XValues = "=" & Sheet_Name & "!$B$23:$B$24" 'ActiveChart.SeriesCollection(3).Values = "=" & Sheet_Name & "!$C$23:$C$24" '---
'系列 4(UCL から 2σ下の線)
'ActiveChart.SeriesCollection.NewSeries
'--- '系列 5(中心線=Ber_X)
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(3).XValues = "='" & Sheet_Name & "'!" & strRange(3, 1)
ActiveChart.SeriesCollection(3).Values = "='" & Sheet_Name & "'!" & strRange(3, 2) '---
'系列 6(LCL から 2σ上の線)
'ActiveChart.SeriesCollection.NewSeries
'ActiveChart.SeriesCollection(6).XValues = "=" & Sheet_Name & "!$B$29:$B$30" 'ActiveChart.SeriesCollection(6).Values ="=" & Sheet_Name & "!$C$29:$C$30" '---
'系列 7(LCL から 1σ上の線)
'ActiveChart.SeriesCollection.NewSeries
'ActiveChart.SeriesCollection(7).XValues = "=" & Sheet_Name & "!$B$31:$B$32" 'ActiveChart.SeriesCollection(7).Values = "=" & Sheet_Name & "!$C$31:$C$32" '---
'系列 8(LCL 管理限界線)
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(4).XValues = "='" & Sheet_Name & "'!" & strRange(4, 1)
ActiveChart.SeriesCollection(4).Values = "='" & Sheet_Name & "'!" & strRange(4, 2) '--- '*************************************************** '--- '系列 2 ActiveChart.SeriesCollection(2).Select '--- With Selection.Format.Line .Visible = msoTrue .ForeColor.ObjectThemeColor = msoThemeColorText1 .ForeColor.TintAndShade = 0 '.ForeColor.Brightness = 0 End With '---
With Selection.Format.Line .Visible = msoTrue .ForeColor.RGB = RGB(255, 0, 0) '線の色 .Transparency = 0 End With '--- With Selection.Format.Line .Visible = msoTrue .Weight = 1 End With '--- With Selection.Format.Line .Visible = msoTrue .DashStyle = msoLineDash '線種(点線) End With '--- '系列 3 'ActiveChart.SeriesCollection(3).Select '--- 'With Selection.Format.Line ' .Visible = msoTrue ' .ForeColor.RGB = RGB(255, 0, 0) 'End With '--- 'With Selection.Format.Line ' .Visible = msoTrue ' .Weight = 1 'End With '--- 'With Selection.Format.Line ' .Visible = msoTrue ' .DashStyle = msoLineDash 'End With 'ActiveChart.Axes(xlValue).MajorGridlines.Select '--- '系列 4
'--- 'With Selection.Format.Line ' .Visible = msoTrue ' .ForeColor.RGB = RGB(255, 0, 0) 'End With '--- 'With Selection.Format.Line ' .Visible = msoTrue ' .Weight = 1 'End With '--- 'With Selection.Format.Line ' .Visible = msoTrue ' .DashStyle = msoLineDash 'End With '--- '系列 5 ActiveChart.SeriesCollection(3).Select '--- With Selection.Format.Line .Visible = msoTrue .ForeColor.RGB = RGB(255, 0, 0) End With '--- With Selection.Format.Line .Visible = msoTrue .Weight = 1 End With '--- With Selection.Format.Line .Visible = msoTrue .DashStyle = msoLineDash End With ActiveChart.PlotArea.Select '---
'系列 6 'ActiveChart.SeriesCollection(6).Select '--- 'With Selection.Format.Line ' .Visible = msoTrue ' .ForeColor.RGB = RGB(255, 0, 0) 'End With '--- 'With Selection.Format.Line ' .Visible = msoTrue ' .Weight = 1 'End With '--- 'With Selection.Format.Line ' .Visible = msoTrue ' .DashStyle = msoLineDash 'End With 'ActiveChart.Axes(xlValue).MajorGridlines.Select 'ActiveChart.PlotArea.Select '--- '系列 7 'ActiveChart.SeriesCollection(7).Select '--- 'With Selection.Format.Line ' .Visible = msoTrue ' .ForeColor.RGB = RGB(255, 0, 0) 'End With '--- 'With Selection.Format.Line ' .Visible = msoTrue ' .Weight = 1 'End With '--- 'With Selection.Format.Line ' .Visible = msoTrue ' .DashStyle = msoLineDash
'--- '系列 8 ActiveChart.SeriesCollection(4).Select '--- With Selection.Format.Line .Visible = msoTrue .ForeColor.RGB = RGB(255, 0, 0) End With '--- With Selection.Format.Line .Visible = msoTrue .Weight = 1 End With With Selection.Format.Line .Visible = msoTrue .DashStyle = msoLineDash End With '--- '系列 1(測定データの線) ActiveChart.SeriesCollection(1).Select '--- With Selection.Format.Line .Visible = msoTrue .ForeColor.RGB = RGB(112, 48, 160) ' .Transparency = 0 End With '*************************************************** '凡例の設定 ActiveChart.Legend.Select ActiveChart.Legend.LegendEntries(1).Select '--- Rn = Len(Kanrizu_Name) BerX_Name = Mid(Kanrizu_Name, 1, Rn - 3) '系列 1 の凡例 '---
Case "BerX 管理図", "BerR 管理図"
'ActiveChart.SeriesCollection(1).Name = "=" & "UCL=" & UCL ActiveChart.SeriesCollection(1).Name = "=""" & BerX_Name & """" 'ActiveChart.SeriesCollection(2).Name = "=" & "UCL=" & UCL
ActiveChart.SeriesCollection(2).Name = "=""" & "UCL=" & UCL & """" 'ActiveChart.SeriesCollection(3).Name = "=" & "LCL=" & LCL
ActiveChart.SeriesCollection(3).Name = "=""" & "LCL=" & LCL & """" Case Else
'ActiveChart.SeriesCollection(1).Name = "=" & "UCL=" & UCL ActiveChart.SeriesCollection(1).Name = "=""" & BerX_Name & """" 'ActiveChart.SeriesCollection(2).Name = "=" & "UCL=" & UCL ActiveChart.SeriesCollection(2).Name = "=""" & "UCL""" 'ActiveChart.SeriesCollection(3).Name = "=" & "LCL=" & LCL ActiveChart.SeriesCollection(3).Name = "=""" & "LCL""" End Select
'ActiveChart.SeriesCollection(4).Name = "=" & "Ber_X=" & BerX ActiveChart.SeriesCollection(4).Name = "=""" & "中心線" & """" '--- ActiveChart.PlotArea.Select '--- '系列 2 のマークスタイルの設定 ActiveChart.SeriesCollection(2).Select Selection.MarkerStyle = -4142 '--- '系列 3 のマークスタイルの設定 ActiveChart.SeriesCollection(3).Select Selection.MarkerStyle = -4142 '--- '系列 4 のマークスタイルの設定 ActiveChart.SeriesCollection(4).Select Selection.MarkerStyle = -4142 '--- '系列 5 のマークスタイルの設定 'ActiveChart.SeriesCollection(5).Select 'Selection.MarkerStyle = -4142 '---
'ActiveChart.SeriesCollection(6).Select 'Selection.MarkerStyle = -4142 '--- '系列 7 のマークスタイルの設定 'ActiveChart.SeriesCollection(7).Select 'Selection.MarkerStyle = -4142 '--- '系列 8 のマークスタイルの設定 'ActiveChart.SeriesCollection(8).Select 'Selection.MarkerStyle = -4142 '****************************************************************************** ActiveChart.ApplyLayout (1) ActiveChart.ChartTitle.Select '--- ActiveChart.ChartTitle.Text = Kanrizu_Name ActiveChart.Axes(xlValue).AxisTitle.Select Selection.Format.TextFrame2.TextRange.Characters.Text = Kanrizu_Name '--- Rn = Len(Kanrizu_Name) '--- With Selection.Format.TextFrame2.TextRange.Characters(1, Rn).ParagraphFormat .TextDirection = msoTextDirectionLeftToRight .Alignment = msoAlignCenter End With '---
With Selection.Format.TextFrame2.TextRange.Characters(1, Rn).Font .BaselineOffset = 0 .Bold = msoTrue .NameComplexScript = "+mn-cs" .NameFarEast = "+mn-ea" .Fill.Visible = msoTrue .Fill.ForeColor.RGB = RGB(0, 0, 0) .Fill.Transparency = 0
.Fill.Solid .Size = 18 .Italic = msoFalse .Kerning = 12 .Name = "+mn-lt" .UnderlineStyle = msoNoUnderline .Strike = msoNoStrike End With '****************************************************************************** n = ActiveSheet.ChartObjects.Count '--- strName = ActiveSheet.ChartObjects(n).Name ActiveSheet.ChartObjects(strName).Activate '縦(Y)軸 ActiveChart.Axes(xlValue, xlPrimary).AxisTitle.Text = "観測値" ActiveChart.Axes(xlValue).AxisTitle.Select Selection.Format.TextFrame2.TextRange.Characters.Text = "観測値" '---
With Selection.Format.TextFrame2.TextRange.Characters(1, 3).ParagraphFormat .TextDirection = msoTextDirectionLeftToRight
.Alignment = msoAlignCenter End With
'---
With Selection.Format.TextFrame2.TextRange.Characters(1, 3).Font .BaselineOffset = 0 .Bold = msoTrue .NameComplexScript = "+mn-cs" .NameFarEast = "+mn-ea" .Fill.Visible = msoTrue .Fill.ForeColor.RGB = RGB(0, 0, 0) .Fill.Transparency = 0 .Fill.Solid .Size = 10 .Italic = msoFalse .Kerning = 12
.UnderlineStyle = msoNoUnderline .Strike = msoNoStrike End With '****************************************************************************** '横(X)軸 ActiveChart.Axes(xlCategory, xlPrimary).AxisTitle.Text = "群番号" ActiveChart.Axes(xlCategory).AxisTitle.Select Selection.Format.TextFrame2.TextRange.Characters.Text = "群番号" '---
With Selection.Format.TextFrame2.TextRange.Characters(1, 3).ParagraphFormat .TextDirection = msoTextDirectionLeftToRight
.Alignment = msoAlignCenter End With
'---
With Selection.Format.TextFrame2.TextRange.Characters(1, 3).Font .BaselineOffset = 0 .Bold = msoTrue .NameComplexScript = "+mn-cs" .NameFarEast = "+mn-ea" .Fill.Visible = msoTrue .Fill.ForeColor.RGB = RGB(0, 0, 0) .Fill.Transparency = 0 .Fill.Solid .Size = 10 .Italic = msoFalse .Kerning = 12 .Name = "+mn-lt" .UnderlineStyle = msoNoUnderline .Strike = msoNoStrike End With '******************************************************************************** '構文 Object.AddTextbox(Orientation, Left, Top, Width, Height)
'Orientation テキスト配置の方向。 'msoTextOrientationHorizontal(水平方向)、msoTextOrientationVertical(垂直方向) など 'MsoTextOrientation 列挙体の値を指定 [省略不可] 'Left テキストボックスの左端位置を指定 [省略不可] 'Top テキストボックスの上端位置を指定 [省略不可] 'Width テキストボックスの幅を指定 [省略不可] 'Height テキストボックスの高さを指定 [省略不可] '================================================================= ActiveChart.ChartArea.Select '--- 'UCL 限界値の表示 If UCL <> 0 Then ActiveChart.Shapes.AddTextbox(msoTextOrientationHorizontal, 285, 43, 50, 15).Select
Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = "UCL=" & UCL '--- Rn = Len(UCL) + 4 '--- Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, Rn).ParagraphFormat. _ FirstLineIndent = 0 '---
With Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, Rn).Font .NameComplexScript = "+mn-cs" .NameFarEast = "+mn-ea" .Size = 11 .Name = "+mn-lt" End With '--- Selection.ShapeRange.ScaleWidth 1.3943661972, msoFalse, msoScaleFromTopLeft
Selection.ShapeRange.ScaleHeight 1.1, msoFalse, msoScaleFromTopLeft End If
If LCL > 0 Then 'LCL 限界値の表示 ActiveChart.Shapes.AddTextbox(msoTextOrientationHorizontal, 285, 139, 50, 15).Select Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = "LCL=" & LCL '--- Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, Rn).ParagraphFormat. _ FirstLineIndent = 0 '---
With Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, Rn).Font .NameComplexScript = "+mn-cs" .NameFarEast = "+mn-ea" .Size = 11 .Name = "+mn-lt" End With End If '--- '中心値の表示 ActiveChart.Shapes.AddTextbox(msoTextOrientationHorizontal, 285, 90, 50, 15).Select
Select Case Kanrizu_Name Case "BerX 管理図"
Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = "BerX=" & BerX
Rn = Len(BerX) + 5 Case "BerR 管理図"
Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = "BerR=" & BerX
Rn = Len(BerX) + 5 Case "Me 管理図"
Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = "Me=" & BerX
Case "R 管理図" Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = "R=" & BerX Rn = Len(BerX) + 2 Case "np 管理図" Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = "np=" & BerX Rn = Len(BerX) + 3 Case "p 管理図" Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = "p=" & BerX Rn = Len(BerX) + 2 Case "c 管理図" Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = "BerC=" & BerX
Rn = Len(BerX) + 4 Case "u 管理図"
Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = "BerU=" & BerX
Rn = Len(BerX) + 5 Case Else
Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = "BerX=" & BerX
Rn = Len(BerX) + 5 End Select '--- Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, Rn).ParagraphFormat. _ FirstLineIndent = 0 '---
With Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, Rn).Font .NameComplexScript = "+mn-cs"
.NameFarEast = "+mn-ea" .Size = 11
.Name = "+mn-lt" End With
'グラフの作成年月日、作成者を表示する AA = Date & Space(1) & strDrafter Rn = Len(AA)
'---
ActiveChart.Shapes.AddTextbox(msoTextOrientationHorizontal, 280, 1, 72, 12).Select
Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = Hiduke & Space(1) & strDrafter '日付、作成者名
'---
AA = Hiduke & Space(1) & strDrafter Rn = Len(AA) '--- Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, Rn).ParagraphFormat. _ FirstLineIndent = 0 '---
With Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, Rn).Font .NameComplexScript = "+mn-cs" .NameFarEast = "+mn-ea" .Size = 8 .Name = "+mn-lt" End With '******************************************************************************** 'Dim DMax As Single
'Dim DMin As Single '--- 'DMax = 175 'DMin = 150 'ActiveSheet.ChartObjects("strName").Activate 'グラフの Y 値の範囲を設定する ActiveChart.Axes(xlValue).Select ActiveChart.Axes(xlValue).MajorGridlines.Select ActiveChart.Axes(xlValue).Select ActiveChart.Axes(xlValue).MinimumScale = DMin
ActiveChart.Axes(xlValue).MaximumScale = DMax '******************************************************************************** 'グラフの表示サイズを設定する ActiveSheet.Shapes(strName).Height = 300 ActiveSheet.Shapes(strName).Width = 460 '******************************************************************************** 'グラフの凡例を削除する
Select Case Kanrizu_Name
Case "BerX 管理図", "BerR 管理図", "R 管理図", "X 管理図" ActiveChart.ChartArea.Select ActiveChart.Legend.Select Selection.Delete Case Else M = ActiveChart.Legend.LegendEntries.Count If M >= 5 Then ActiveChart.ChartArea.Select ActiveChart.Legend.Select ActiveChart.Legend.LegendEntries(5).Select Selection.Delete End If End Select Exit Sub '******************************************************************************** * errorHandler: MsgBox Err.Description Resume Next End Sub