私はこれに少し慣れていません。列を取得して整数のセル データを配置し、その範囲内のすべての値を関数に入れて、結果を Excel ワークブックの別の列に出力するにはどうすればよいでしょうか。したがって、出力列は、関数への入力に列 G、J、および K を使用する Comm 列全体になります。=100000*slotNumber+300*xpos+ypos
A B C D E F G H I J K
1 Proc Equip Operat Shift Comm Casette SlotNumber Diam Measure XPos YPos
2
3'
したがって、それぞれの値を取得して for ループを作成した場合、値を取得して何らかの方法でこれらすべてを実行できると考えましたが、方法がわかりません! よろしくお願いします!
編集:すべての列が格納されています。式のために、配列の値を関数に 1 つずつ渡す必要がありZ = 100000*slotArr(i)+300xList(i)+yList(i)
ます。または、for ループに配置することもできます。
編集:関数をループに配置した...関数の行で、範囲外のエラーが発生しています。
Sub cmdMeans_Click()
Dim i As Long, j As Long
Dim slotList As Range, slotArr() As Variant, xList As Range, xArr() As Variant
Dim yList As Range, yArr() As Variant, cArr() As Variant
Set slotList = Range("P2", Range("P2").End(xlDown))
slotArr() = slotList.Value
Set xList = slotList.Offset(0, 4)
xArr() = xList.Value
Set yList = slotList.Offset(0, 5)
yArr() = yList.Value
'Only one counter required because of the dependancy on the range slotList
For i = 2 To UBound(slotArr, 1)
'Dimensioning Array
ReDim cArr(UBound(slotArr, 1), 1)
cArr(i, 1) = (100000 * slotArr(i, 1)) + (300 * xList(i, 1)) + yList(i, 1)
'MsgBox ("Comment Cell Value" & cArr(i, 1))
Next
'Resizing Array
ReDim Preserve cArr(i)
'This is where the new values will be written to the comment column
Dim cRng As Range
Set cRng = Range(Cells(14, 1), Cells(UBound(cArr(i))))
cRng.Value = Application.Transpose(cArr)
End Sub