Help: How to pass a cell matrix as a variable in the arguments of a VBA function# Programming - 葵花宝典
n*u
1 楼
I need to pass a cell matrix with variable size (m X n) to a own defined VBA
fuction myfun(dataRange as Range). In this function the selected cell
matrix will be stored in an data array. I used to use Range.CurrentArray or
Range.Value2 to store the data into an assigned array variable successfully.
However, it requires the cells contain no formula. If the data in the cells
are obtained by a formula, everything screws up.
The code is shown below:
‘The function stores the data in selected cell mat
fuction myfun(dataRange as Range). In this function the selected cell
matrix will be stored in an data array. I used to use Range.CurrentArray or
Range.Value2 to store the data into an assigned array variable successfully.
However, it requires the cells contain no formula. If the data in the cells
are obtained by a formula, everything screws up.
The code is shown below:
‘The function stores the data in selected cell mat