Fill array with Values

  • Follow


Thanks for taking the time to read my question.

This does not work, and I'm not sure how else to write the code so that each 
array will be filled with the values.

Any help would be great,

Thanks,

Brad


code=========================
Dim lowlet() As String
Dim upperlet() As String
Dim thenum() As Integer
Dim chara() As String

lowlet() = "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z"
upperlet() = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z"
thenum() = "1,2,3,4,5,6,7,8,9,0"
chara() = "!@#%^*"
0
Reply Utf 4/12/2010 8:40:01 PM

Hi
At top of module put
Option Base 1

Inside a sub you can do
 lowlet =3D Array("a", "b",... etc)

then lowlet(2) will be "b" as array counting starts at 1.
regards
Paul
Note you could probably do these examples more efficiently using ascii
codes and looping to fill the arrays.

> upperlet() =3D "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z"
> thenum() =3D "1,2,3,4,5,6,7,8,9,0"
> chara() =3D "!@#%^*"
On Apr 12, 9:40=A0pm, Brad <B...@discussions.microsoft.com> wrote:
> Thanks for taking the time to read my question.
>
> This does not work, and I'm not sure how else to write the code so that e=
ach
> array will be filled with the values.
>
> Any help would be great,
>
> Thanks,
>
> Brad
>
> code=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D
> Dim lowlet() As String
> Dim upperlet() As String
> Dim thenum() As Integer
> Dim chara() As String
>
> lowlet() =3D "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z"
> upperlet() =3D "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z"
> thenum() =3D "1,2,3,4,5,6,7,8,9,0"
> chara() =3D "!@#%^*"

0
Reply Paul 4/12/2010 8:56:41 PM


Sorry, forgot to mention you will have to declare
Dim lowlet as Variant

regards
Paul

On Apr 12, 9:40=A0pm, Brad <B...@discussions.microsoft.com> wrote:
> Thanks for taking the time to read my question.
>
> This does not work, and I'm not sure how else to write the code so that e=
ach
> array will be filled with the values.
>
> Any help would be great,
>
> Thanks,
>
> Brad
>
> code=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D
> Dim lowlet() As String
> Dim upperlet() As String
> Dim thenum() As Integer
> Dim chara() As String
>
> lowlet() =3D "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z"
> upperlet() =3D "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z"
> thenum() =3D "1,2,3,4,5,6,7,8,9,0"
> chara() =3D "!@#%^*"

0
Reply Paul 4/12/2010 8:58:03 PM

Try these...

lowlet() = Split("a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z", ",")
upperlet() = Split("A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z", 
",")
thenum() = Split("1,2,3,4,5,6,7,8,9,0", ",")
chara() = Split("!,@,#,%,^,*", ",")

I'm curious as to why you are setting up these particular arrays and how you 
plan to use them... depending on what it is you are going to do with these 
arrays, it is possible that there might be other (more efficient) ways to do 
it without using these arrays.

-- 
Rick (MVP - Excel)



"Brad" <Brad@discussions.microsoft.com> wrote in message 
news:E3388032-3549-46ED-9462-B4B9DD8ED15C@microsoft.com...
> Thanks for taking the time to read my question.
>
> This does not work, and I'm not sure how else to write the code so that 
> each
> array will be filled with the values.
>
> Any help would be great,
>
> Thanks,
>
> Brad
>
>
> code=========================
> Dim lowlet() As String
> Dim upperlet() As String
> Dim thenum() As Integer
> Dim chara() As String
>
> lowlet() = "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z"
> upperlet() = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z"
> thenum() = "1,2,3,4,5,6,7,8,9,0"
> chara() = "!@#%^*" 

0
Reply Rick 4/12/2010 8:58:30 PM

Thanks to both of you for your great replies. They were very helpful

Have a great day,

Brad

"Brad" wrote:

> Thanks for taking the time to read my question.
> 
> This does not work, and I'm not sure how else to write the code so that each 
> array will be filled with the values.
> 
> Any help would be great,
> 
> Thanks,
> 
> Brad
> 
> 
> code=========================
> Dim lowlet() As String
> Dim upperlet() As String
> Dim thenum() As Integer
> Dim chara() As String
> 
> lowlet() = "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z"
> upperlet() = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z"
> thenum() = "1,2,3,4,5,6,7,8,9,0"
> chara() = "!@#%^*"
0
Reply Utf 4/12/2010 9:41:02 PM

4 Replies
235 Views

(page loaded in 0.138 seconds)


Reply: