View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
D_Rennie[_3_] D_Rennie[_3_] is offline
external usenet poster
 
Posts: 1
Default how to store values in a 2 dimensional array


hello.

You can use this as a method for fulling up the 2 demitional array
Code:
--------------------
Sub FullArray()

Dim ShtNm_Pass(1 To 4, 1 To 4): 'allowed for 4 sheets
Dim x As Long

With ThisWorkbook

For x = 1 To 4
'Loading the sheet names
ShtNm_Pass(x, 1) = .Sheets(x).Name
'if passwords are stored on a sheet (used the name hidden in this case)
ShtNm_Pass(x, 2) = Sheets("Hidden").Cells(x, 1)
Next x

'full the second half of the array (password manually)
' ShtNm_Pass(1, 2) = "1"
' ShtNm_Pass(2, 2) = "2"
' ShtNm_Pass(3, 2) = "3"
' ShtNm_Pass(4, 2) = "4"


'cheeking the array has been fulled. You dont need this only here for testing
For x = LBound(ShtNm_Pass, 1) To UBound(ShtNm_Pass, 1)
Debug.Print ShtNm_Pass(x, 1)
Debug.Print ShtNm_Pass(x, 2)
Next x

End With

End Sub
--------------------


as the debug.print you can pull out the information form the array when
ever you like. eg ShtNm_Pass(1, 1) would be the sheet name and
ShtNm_Pass(1, 2) would be the corrosponding password.

hope this helps


--
D_Rennie
------------------------------------------------------------------------
D_Rennie's Profile: 1412
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=172487

Microsoft Office Help