G
Guest
I am testing a macro and I cant figure out what I'm doing wrong. I have
named a range, dvec, that contains contiguous data. I want to pass the
number of data points, n, to the array cvec(n). To test this I inserted the
MsgBox line. When I run this macro, I get the number of rows in the range
dvec rather than the count of data points. What am I doing wrong? I have
made sure all blank cells in the range are clear.
Option Base 1
Sub SelectCount()
'Re-Dim data array cvec
Dim n, cvec
Sheets("Sheet2").Range("dvec").Select
n = Selection.Count
ReDim cvec(n)
MsgBox "The size of vector cvec is " & n
End Sub
TIA
Steve H
named a range, dvec, that contains contiguous data. I want to pass the
number of data points, n, to the array cvec(n). To test this I inserted the
MsgBox line. When I run this macro, I get the number of rows in the range
dvec rather than the count of data points. What am I doing wrong? I have
made sure all blank cells in the range are clear.
Option Base 1
Sub SelectCount()
'Re-Dim data array cvec
Dim n, cvec
Sheets("Sheet2").Range("dvec").Select
n = Selection.Count
ReDim cvec(n)
MsgBox "The size of vector cvec is " & n
End Sub
TIA
Steve H