そのなって、私はそう私を許してくださいエクセルVBAで配列を使用しましたので、しばらく...は、動的配列VBAを使用して傾きと切片を決定
私はある連続したマッチング細胞をベース動的配列を定義しようとしていますループで決定される。私は私の構文が間違っていると確信しています。難しいのは、私の配列が1列の約6連続した行と、別の列の別のセルとで構成されていることです。何か案は?
Sub calib_range()
Dim instrument As Variant
Dim calibrator As Variant
Dim lastrow As Integer
lastrow = ThisWorkbook.ActiveSheet.Range("b2").SpecialCells(xlCellTypeLastCell).Row
For i = 4 To lastrow
If Cells(i, 4) Like "MPC*" Then
'enter loop to determine length of MPC* array
For x = i + 1 To lastrow
If Cells(x, 4) = Cells(x - 1, 4) Then
Else
x = x - 1
Exit For
End If
Next x
instrument = Array(Cells(i, 17), Range(Cells(i, 14), Cells(x, 14)))
calibrator = Array(0, Range(Cells(i, 12), Cells(x, 12)))
Slope = Application.WorksheetFunction.Slope(instrument, calibrator)
Intercept = Application.WorksheetFunction.Intercept(instrument, calibrator)
Cells(i, 22) = Slope
Cells(i, 23) = Intercept
End If
Next i
End Sub
(X - 1、4)Then'、それがまっすぐElse''に行く - あなたが欠落していますコード?なぜ、 'If'ステートメントがそれのように書かれているのですか? – BruceWayne
@ BruceWayneこれは、2つのセルの値が似ている可能性があるため、elseには移動しません。 – Vityata
@Vityata - 確かにちょっと不思議なことに、 'If Cells()<>セルのように設定しないと、// x = x-1 // Exit For'のようになります。 (そして、カイルの接線問題については申し訳ありませんが、私はこれが問題の一部だとは思わないと思いました。) – BruceWayne