I ran into some issues with Excel related VBScript. I know there's probably a straight forward solution for this that will later on seem obvious, but anyways:
All I'm trying to achieve here is basically getting the lengths of the longest values in each column and write them back to an array (one value for each of the first 16 column). Simple as that.
...
mlen = Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
For i = 1 To 16
rw2 = 2 ' starting from the second row
While Cells(rw2, i) <> "" ' all the way until an empty field is found
If Len(Cells(rw2, i)) > mlen(i - 1) Then mlen(i - 1) = Len(Cells(rw2, i))
rw2 = rw2 + 1
Wend
Next
...
However, it gives me a type mismatch for the "mlen(i-1)" on the right side of the ">" operator.
Any solution would be much appreciated. Thanks in advance and have a great day!
tmax <> mlen!
>> mlen = Array(0, 0, 0)
>> WScript.Echo mlen(0)
>> WScript.Echo tmax(0)
>>
0
Error Number: 13
Error Description: Typenkonflikt (i.e. type-mismatch)
>>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.