talonboi02
New Member
- Joined
- Apr 12, 2012
- Messages
- 3
Hello! I’m a rookie VBA user and am having difficulties with a project.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com
ffice
ffice" /><o
></o
>
<o
></o
>
I have 3 worksheets in the same workbook entitled:<o
></o
>
data <o
></o
>
equipment<o
></o
>
station<o
></o
>
In the equipment worksheet, I have the following in columns 1, 2, 3<o
></o
>
<o
></o
>
EQUIP FC BC
(strings) (int) (int)<o
></o
>
I want to define an array for the equipment worksheet - a Variant array (with both Integer and String values) holding 185 rows and 3 columns and populate it with the data from the equipment worksheet.
<o
></o
>
<o
></o
>
Can someone direct me on how to create it? This is how bad I am at VBA – my attempt below:
<o
></o
>
<o
></o
>
Dim equipmentArray(0 to 184, 0 to 2) As Variant
Dim i = integer
<o
>i = 0</o
>
Sheets("equipment").Select<o
></o
>
Range("A3:C185").Select<o
></o
>
While (ActiveCell.Value <> "")<o
></o
>
equipmentArray (i, 0) = ActiveCell.Value<o
></o
>
equipmentArray (i, 1) = ActiveCell.Value<o
></o
>
equipmentArray (i, 2) = ActiveCell.Value<o
></o
>
ActiveCell.Offset(i + 1, 0).Select<o
></o
>
Wend<o
></o
>
<o
>
</o
>Doesn’t seem to work – I only get 1 column. Any help is appreciated!<o
></o
>
I'm guessing I'm missing a loop somewhere? Thanks.




<o


I have 3 worksheets in the same workbook entitled:<o


data <o


equipment<o


station<o


In the equipment worksheet, I have the following in columns 1, 2, 3<o


<o


EQUIP FC BC
(strings) (int) (int)<o


I want to define an array for the equipment worksheet - a Variant array (with both Integer and String values) holding 185 rows and 3 columns and populate it with the data from the equipment worksheet.
<o


<o


Can someone direct me on how to create it? This is how bad I am at VBA – my attempt below:
<o


<o


Dim equipmentArray(0 to 184, 0 to 2) As Variant
Dim i = integer
<o


Sheets("equipment").Select<o


Range("A3:C185").Select<o


While (ActiveCell.Value <> "")<o


equipmentArray (i, 0) = ActiveCell.Value<o


equipmentArray (i, 1) = ActiveCell.Value<o


equipmentArray (i, 2) = ActiveCell.Value<o


ActiveCell.Offset(i + 1, 0).Select<o


Wend<o


<o

</o



I'm guessing I'm missing a loop somewhere? Thanks.