Range Values

  • Thread starter Thread starter JJ
  • Start date Start date
J

JJ

Is there a way to return the values from a range without iterating through
each cell using VBA?

Thanks
 
Hi JJ

not sure exactly what you mean here, could you type out an examle of what's
in the range and what you want to see (and where) from the output and maybe
explain the purpose of what you're after.

Cheers
JulieD
 
A1 has A
A2 has B
A3 has C

I want to get the array back for the range which would be {A,B,C}. Is there
a VBA function command that would return the array for the range A1:A3?
 
You could put them into a two dimensional array (rows by columns):

dim myArr as Variant
dim myRng as Range
dim iCtr as long
dim jCtr as long

with activesheet
set myrng = .range("b3:c9")
myarr = myrng.value
end with

for ictr = lbound(myarr,1) to ubound(myarr,1)
for jctr = lbound(myarr,2) to ubound(myarr,2)
msgbox myarr(ictr,jctr)
next jctr
next ictr

But I'm not sure what return means.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top