#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Arrays

I'm using an array, but I don't know the number of rows.
Does anyone know if I can do this.

Dim Defect() As Variant, Sum As Single, RowCount As Variant
Dim Count As Single, GrandTotal As Integer


RowCount = ActiveWorkbook.Worksheets("Sheet1").Cells
(Rows.Count, 10).End(xlUp).Value < ""
ReDim Defect(RowCount, 34)

For i = 1 To RowCount
For j = 1 To 34
Defect(i, j) = ActiveWorkbook.Worksheets
("Sheet1").Cells(i, j)
Next j
Next i

Thanks,
Lacy

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 783
Default Arrays

Lacy wrote:
I'm using an array, but I don't know the number of rows.
Does anyone know if I can do this.

Dim Defect() As Variant, Sum As Single, RowCount As Variant
Dim Count As Single, GrandTotal As Integer


RowCount = ActiveWorkbook.Worksheets("Sheet1").Cells
(Rows.Count, 10).End(xlUp).Value < ""
ReDim Defect(RowCount, 34)

For i = 1 To RowCount
For j = 1 To 34
Defect(i, j) = ActiveWorkbook.Worksheets
("Sheet1").Cells(i, j)
Next j
Next i

Thanks,
Lacy

What happened when you tried it?

Alan Beban
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Arrays

Lacey,

I think this is easier.

rowcount = Activesheet.UsedRange.Rows.Count
or
rowcount = Activecell.CurrentRegion.Rows.Count
if you already have a cell selected

CurrentRegion and UsedRange are explained in the Help

Regards,
Mike
-----Original Message-----
I'm using an array, but I don't know the number of rows.
Does anyone know if I can do this.

Dim Defect() As Variant, Sum As Single, RowCount As

Variant
Dim Count As Single, GrandTotal As Integer


RowCount = ActiveWorkbook.Worksheets("Sheet1").Cells
(Rows.Count, 10).End(xlUp).Value < ""
ReDim Defect(RowCount, 34)

For i = 1 To RowCount
For j = 1 To 34
Defect(i, j) = ActiveWorkbook.Worksheets
("Sheet1").Cells(i, j)
Next j
Next i

Thanks,
Lacy

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Arrays

Thanks for the help.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA arrays Matt Excel Discussion (Misc queries) 3 February 22nd 09 06:36 PM
two arrays Jerry Kinder New Users to Excel 4 February 26th 06 08:29 AM
Need help with arrays (I think) rbhedal Excel Worksheet Functions 3 October 19th 05 07:24 AM
arrays solo_razor[_44_] Excel Programming 2 December 15th 03 12:06 PM
arrays and others.. Locachica[_3_] Excel Programming 4 December 3rd 03 09:39 PM


All times are GMT +1. The time now is 03:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"