Dim OpenFileName As String Dim fNmae As String Dim MaxRow, MaxCol As Long Dim R1_2, R1_3, R2_3 As Long Dim ch, dataN As Long Dim startN, endN, i, j As Long Dim tourokuN As Integer Dim MaxN, MinN, PtoP As Long Dim Yvalue As Long Dim slopeN, interceptN As Long Dim Cursol1, Cursol_1 As Integer Dim Cursol2, Cursol_2 As Integer Dim Yscale, Xscale As Long Dim sig As Single Private Sub CheckBox1_Click() startN = 1 endN = MaxRow Call allGraph(startN, endN, MaxCol) End Sub Private Sub CheckBox2_Click() startN = Userform1.TextBox2.Value endN = Userform1.TextBox3.Value Call allGraph(startN, endN, MaxCol) End Sub Private Sub CommandButton1_Click() 'OPEN CSV FILE OpenFileName = Application.GetOpenFilename("CPLTファイル,*.csv?") Workbooks.Open OpenFileName TextBox1.Value = OpenFileName ActiveSheet.Name = "sheet1" MaxRow = Range("A2").End(xlDown).Row MaxCol = Range("A2").End(xlToRight).Column ch = MaxCol dataN = MaxRow For i = 1 To MaxRow Cells(i, MaxCol + 1) = 1000 Next i TextBox21.Value = ch TextBox22.Value = dataN ScrollBar1.Min = 0 ScrollBar1.Max = dataN ScrollBar2.Min = 0 ScrollBar2.Max = dataN Cursol_1 = 1 Cursol_2 = 1 End Sub '===============================Max Min P-P ================================================== Private Sub CommandButton2_Click() '計算 startN = TextBox2.Value endN = TextBox3.Value For i = 1 To ch MaxN = Application.WorksheetFunction.Max(Range(Cells(startN, i), Cells(endN, i))) MinN = Application.WorksheetFunction.Min(Range(Cells(startN, i), Cells(endN, i))) Controls("TextBox" & i + 3).Value = MaxN 'range Max Controls("TextBox" & i + 12).Value = MinN 'range Min Controls("TextBox" & i + 12).Value = MaxN - MinN 'Peak to Peak Next i R1_2 = Application.WorksheetFunction.Correl(Range(Cells(startN, 1), Cells(endN, 1)), Range(Cells(startN, 2), Cells(endN, 2))) R1_3 = Application.WorksheetFunction.Correl(Range(Cells(startN, 1), Cells(endN, 1)), Range(Cells(startN, 3), Cells(endN, 3))) R2_3 = Application.WorksheetFunction.Correl(Range(Cells(startN, 2), Cells(endN, 2)), Range(Cells(startN, 3), Cells(endN, 3))) TextBox8.Value = R1_2 TextBox9.Value = R1_3 TextBox10.Value = R2_3 End Sub Private Sub CommandButton3_Click() '登録 データがOKなら登録番号行に記録 tourokuN = TextBox12.Value Cells(tourokuN, ch + 1) = tourokuN Cells(tourokuN, ch + 2) = Yvalue For i = 1 To ch Cells(tourokuN, i + ch + 2) = Controls("TextBox" & i + 3).Value Cells(tourokuN, i + ch * 2 + 2) = Controls("TextBox" & i + 12).Value Next i Cells(tourokuN, 20) = TextBox2.Value Cells(tourokuN, 21) = TextBox3.Value TextBox12.Value = tourokuN + 1 End Sub Private Sub Label16_Click() End Sub Private Sub Label20_Click() End Sub Private Sub ScrollBar1_Change() '開始カーソル指定 Cursol1 = ScrollBar1.Value TextBox2.Value = Cursol1 Yscale = ActiveChart.Axes(xlValue).MaximumScale Range(Cells(Cursol_1, MaxCol + 1), Cells(Cursol_1, MaxCol + 1)).Clear ActiveChart.SeriesCollection(MaxCol + 1).Select '系列を選択 黒 1 赤3 緑4 青5 With Selection.Border .ColorIndex = 3 End With Cells(Cursol1, MaxCol + 1) = Yscale Cursol_1 = Cursol1 End Sub Private Sub ScrollBar2_Change() 'If ScrollBar2.Value > ScrollBar1.Value Then Cursol2 = ScrollBar2.Value TextBox3.Value = Cursol2 Yscale = ActiveChart.Axes(xlValue).MaximumScale Range(Cells(Cursol_2, MaxCol + 1), Cells(Cursol_2, MaxCol + 1)).Clear ActiveChart.SeriesCollection(MaxCol + 1).Select '系列を選択 黒 1 赤3 緑4 青5 With Selection.Border .ColorIndex = 3 End With Cells(Cursol2, MaxCol + 1) = Yscale Cursol_2 = Cursol2 'End If End Sub Private Sub Chart_MouseUp(ByVal Button As Long, ByVal Shift As Long, ByVal x As Long, ByVal y As Long) Dim ElemID As Long, Arg1 As Long, Arg2 As Long Dim Var As Variant Dim Msg As String 'GetChartElementメソッドを用いてクリックしたデータ系列を取得。 '第三引数以降に対象オブジェクトの情報が格納される '※データ系列の場合は第四引数:SeriesIndex,第五引数:PointIndex ActiveChart.GetChartElement x, y, ElemID, Arg1, Arg2 '変数ElemIDに格納されたElementIDにより処理を分岐 Select Case ElemID '定数値の詳細はヘルプを参照 Userform1.TextBox2.Value = x Case xlSeries 'データ系列 'GetChartElementの第五引数に格納された情報(ここではPointIndex) 'をもとにSeriesオブジェクトから項目名と値を取得 Var = ActiveChart.SeriesCollection(Arg1).XValues Msg = "要素:" & Var(Arg2) Var = ActiveChart.SeriesCollection(Arg1).Values Msg = Msg & vbCrLf & "値:" & Var(Arg2) MsgBox Msg Case Else 'その他の処理 End Select End Sub Private Sub TextBox10_Change() End Sub Private Sub TextBox13_Change() End Sub Private Sub TextBox3_Change() End Sub Private Sub TextBox4_Change() End Sub Private Sub UserForm_Click() End Sub