Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Arrays in VBA

Status
Not open for further replies.

Adamba

IS-IT--Management
Aug 3, 2001
72
GB
Hiya all,

Would anyone know how to set up and use an array in VB?
What i am trying to do is set up a 'phone pad' style Coding System.

E.g.

the Array would assign Letters to a Number:
A,B,C ->2
D,E,F ->3
G,H,I ->4
etc.

then to code an input string as numbers:

Adam -> 2326

Thanks in advance.
[pc3]
Adam [glasses]
 
Hi,

Arrays - check in help
First you Dim you array with the number of elements and dimensions
Then you assign values
For instance...
Code:
Dim Myarray(2)
MyArray(0) = value1
MyArray(1) = value2

BUT...
in your requirement, i would not necessarily use an array for this application. I would use Select Case as follows...
Code:
Select Case DialButtonValue
   Case "A", "B", "C"
      NumValue = 2
   Case "D", "E", "F"
      NumValue = 3
...etc
End Select
All kinds of ways to skin a cat... :) Skip,
metzgsk@voughtaircraft.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top