View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Get number of columns and rows

Assuming data starts in A1 and there are no blank rows or columns embedded

Dim v() as Variant
set rng = Activesheet.Range("A1").CurrentRegion
numrows = rng.rows.count
numcols = rng.columns.count
redim v(1 to numrows, 1 to numcols)
for i = numrows
for j = numcols
v(i,j) = rng(i,j).value
Next
Next

or


for i = numrows
for j = numcols
val(i,j) = cells(i,j).Value
next
Next

--
Regards,
Tom Ogilvy


"Artem Omelianchuk" wrote in
message ...
Hi.
I want to read all sheet from excel to my program. As i understand, i can
use cell(i,j), but for this i need number of rows and columns, how can i

get
it?