This is to do with ranges and arrays, which I find utterly confusing!
I am reading a range into an array variable as follows:
Output = Range(Results.Cells(2, 1), Results.Cells(2, 100)).Value
where Output
is a Variant
array of size 100, and Results
is the name of the worksheet.
I want to pass this array Output
as an argument to another sub as follows:
DBUpdate (Output)
The DBUpdate
sub is defined as:
Sub DBUpdate(Output() as Variant)
However, when I run this, I get the following error:
Compile error:
Type mis-match: array or user-defined type expected
As I understand, I have defined Output
as an array throughout and I have tried everything imaginable to try to overcome this, but failed. Can anyone here point me in the right direction, please?