Thread: Declaring Array
View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Declaring Array

Dim Array1()
Dim NumOfRows as Integer
Dim sh as Worksheet, sh1 as Worksheet
NumOfRows = 200
ReDim Array1( 0 to NumOfRows, 1 To 2 )

' code that loads the array

set sh1 = Activesheet

Worksheets.Add After:=Worksheets(worksheets.count)
set sh = Activesheet
sh.Range("A1").Resize(ubound(Array1,1) - _
lbound(array1,1) + 1, 2).Value = Array1
Msgbox "Look at the array"
Application.DisplayAlerts = False
sh.Delete
Application.displayAlerts = True
sh1.Activate

--
Regards,
Tom Ogilvy


"Fredriksson via OfficeKB.com" wrote:

I will need to calc the number of rows from a worksheet that is being updated.


Once I get my Array loaded. Is there a quick way to display the contents in
the array to verify that I loaded it correctly.

Thanks for your help


Tom Ogilvy wrote:
will you know the number of rows before you declare the array?

Dim v() as Double

i = Inputbox("Enter number of rows")
if not isnumeric(i) then
exit sub
End if
redim v(i,10)

--
Regards,
Tom Ogilvy

How do I declare an array where I know the Number of Columns but the number
of rows is Dynamic The Columns should be type text


--
Message posted via http://www.officekb.com