Last post Oct 04, 2016 11:01 AM by sg48asp
Oct 03, 2016 01:27 PM|sg48asp|LINK
I am getting this warning re vCellArray in next to last line of function
Public Function ExtractCells(ByRef OrigFormula As String) As Object(,)
Dim vCellArray(,) As Object
'Irrelevant Code deleted
ValidCellCount = ValidCellCount + 1
ReDim Preserve vCellArray(3, ValidCellCount)
vCellArray(0, 0) = ValidCellCount
vCellArray(1, ValidCellCount) = tempStr
vCellArray(2, ValidCellCount) = PossibleStartPosition
vCellArray(3, ValidCellCount) = PossibleEndingPosition
ValidCell = False
If ValidCellCount = 0 Then
ReDim Preserve vCellArray(3, ValidCellCount + 1)
vCellArray(0, 0) = 0
ExtractCells = vCellArray
Oct 04, 2016 06:52 AM|Yohann Lu|LINK
As far as I know, The warning lets you know that there is no Array object associated with the variable, if you run it you will get an exception as there is no Array object so it can't assign a value to an element.
So, please debug your code step by step to find which code causes the warning. You could also share us more relevant code to help us reproduce the problem.
Oct 04, 2016 07:10 AM|oned_gk|LINK
Dim vCellArray(,) As Object = Nothing
Oct 04, 2016 10:53 AM|sg48asp|LINK
If I run it, there is no error. This is just a warning at before running.
Oct 04, 2016 11:01 AM|sg48asp|LINK
I also tried Dim vCellArray(3,100) which also worked. It gets redimensioned later.