1
マクロでコードを作成しようとしているプロセスがあります。範囲内のすべての行については 行内に空でないセルの配列を均等に配置する
:私は、行の非空のセルを選択しようとしています。
これらのセルの最小値は
n_1
です。与えられた乗算係数
a
は、最小値で始まる等間隔番号の配列(空でない行と同じ長さ)、つまり(n_k = (a^k)*n_1
)を作成します。
これらの線に沿って何か
Dim a As Range, b As Range, number_of_elements as Integer
Set a = Range()
For Each b In a.Rows
Dim newarray as Variant 'initialize new array
arr = select_non_empty_cells(b) 'select non empty cells
number_of_elements = Ubound(arr) 'get number of elements
ReDim newarray(1 To number_of_elements) As Integer 'set the dimension
min_val = WorksheetFunction.Min(arr.Value) 'pick minimum value
For counter = 1 To number_of_elements 'create new array with equally spaced numbers
newarray(counter) = min_val*1.25^counter 'multiplying factor
Next counter
arr.Value = newarray.Value 'set the non empty range to new values
Next
そして、以下は私のデータがどのように見えるかです。したがって、最初の行では1033.2(最小値)を選択し、均等に間隔を置いた5つの要素の同じ長さの新しい配列を作成します。 2行目と同じです。
のthats役立ちます。ありがとうございました。私は私の質問を編集して、私がしようとしていることについてより詳細に説明しました。 – Koba