I'm trying to replicate this VBA code in VB.NET
which gives this as result
how can i do this with one line of code in VB.NET?
(I already know to do this with iterations and arrays)
Thanks a lot to everyone who will reply!
I'm trying to replicate this VBA code in VB.NET
which gives this as result
how can i do this with one line of code in VB.NET?
(I already know to do this with iterations and arrays)
Thanks a lot to everyone who will reply!
Copyright © 2021 Jogjafile Inc.


First off, don't try and reproduce that VBA code. It's bad and will give you problems - someone's used an unqualified range so there's no telling what data you're doing to get from that.
For a one-liner in VB.Net, you could just
Castthe range array using theObjecttype and call theToArray()method - remember that you'd need toDirectCastthe range to a 2DObjectarray first to access theCastmethod. Something like this (using a qualified range):In VBA, if only one cell is defined in the range (eg "A1") then the value type is a Variant rather than an array of Variants, so any attempt to reference it as an array will throw an error. The same would occur in this VB code if you only referenced one cell.