ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   arrays (https://www.excelbanter.com/excel-programming/285442-arrays.html)

solo_razor[_44_]

arrays
 
hello,

I want to assign about 100 variables, i want to do this in an array.
These varables are found in cells a1 to a100. Not all cells are full
Does anybody has some sample code?

Regards,
Nie

--
Message posted from http://www.ExcelForum.com


TonyM

arrays
 
Try this:-

**********************

Option Explicit

Option Base 1

Sub fillArray()

Dim arrayToFill(100) As Variant
Dim i As Long

For i = 1 To 100
arrayToFill(i) = Me.Range("A" & i)
Next

End Sub

******************

hth, TonyM


-----Original Message-----
hello,

I want to assign about 100 variables, i want to do this

in an array.
These varables are found in cells a1 to a100. Not all

cells are full.
Does anybody has some sample code?

Regards,
Niek


---
Message posted from http://www.ExcelForum.com/

.


Bob Phillips[_6_]

arrays
 
.... or more simply

Dim myArray

myArray = Range("A1:A100")

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"TonyM" wrote in message
...
Try this:-

**********************

Option Explicit

Option Base 1

Sub fillArray()

Dim arrayToFill(100) As Variant
Dim i As Long

For i = 1 To 100
arrayToFill(i) = Me.Range("A" & i)
Next

End Sub

******************

hth, TonyM


-----Original Message-----
hello,

I want to assign about 100 variables, i want to do this

in an array.
These varables are found in cells a1 to a100. Not all

cells are full.
Does anybody has some sample code?

Regards,
Niek


---
Message posted from http://www.ExcelForum.com/

.





All times are GMT +1. The time now is 12:02 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com