Perhaps I would do this task by a pedantic slog.
Pass the whole array to the sub and select the column of your choice and give those elemrnts a value of your choice.
Code: Select all
Sub test(ary() As Long,column As Long,value As Long)
Dim As Long d=Ubound(ary,0)'GET_DIMENSION(array)
Select Case d
Case 1
For a As Long=Lbound(ary,1) To Ubound(ary,1)
If a=column Then ary(a)=value
Next
Case 2
For a As Long=Lbound(ary,1) To Ubound(ary,1)
For b As Long=Lbound(ary,2) To Ubound(ary,2)
If b =column Then ary(a,b)=value
Next:Next
Case 3
For a As Long=Lbound(ary,1) To Ubound(ary,1)
For b As Long=Lbound(ary,2) To Ubound(ary,2)
For c As Long=Lbound(ary,3) To Ubound(ary,3)
If c =column Then ary(a,b,c)=value
Next:Next:Next
Case 4
For a As Long=Lbound(ary,1) To Ubound(ary,1)
For b As Long=Lbound(ary,2) To Ubound(ary,2)
For c As Long=Lbound(ary,3) To Ubound(ary,3)
For d As Long=Lbound(ary,4) To Ubound(ary,4)
If d =column Then ary(a,b,c,d)=value
Next:Next:Next :Next
case 5
'to be continued
case 6
case 7
case 8
End Select
End Sub
'example 1
Dim ary(2 To 4,0 To 6,2 To 4) As long
test(ary(),3,5)
For a As Long=Lbound(ary,1) To Ubound(ary,1)
For b As Long=Lbound(ary,2) To Ubound(ary,2)
For c As Long=Lbound(ary,3) To Ubound(ary,3)
Print ary(a,b,c);
Next:Print:Next:Print:Next
'============
'example 2
Dim array(1 To 5,1 To 5) As long
'set some values
For a As Long=Lbound(array,1) To Ubound(array,1)
For b As Long=Lbound(array,2) To Ubound(array,2)
array(a,b)=Rnd*100
Next:Next
test(array(),2,9)
For a As Long=Lbound(array,1) To Ubound(array,1)
For b As Long=Lbound(array,2) To Ubound(array,2)
Print array(a,b);
Next:Print:Next
Sleep
It does bypass the headache of memcpy or descriptors.