Help with Array

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi and thanks in advance


I have created a new puzzel grid 10 x 10 (Rows A - J) & Cols (0-9)

Each grid is allowed 1 digit (Bit like SUDOKU)

My information is stored in a string (PuzSTR) 100 in len

Question is

1. How do I load the grid chr 1 goes in A0, Chr 2 in A1 and so on. I
would like to do this in a loop.

2. How to I put the grid back to (PuzSTR) A0 to Chr 1, A1 to Chr 2 & So on.
Once again would like to do it in a loop.

Thanks once again

Trev
 
I haven't tested extensively, but I believe the following will put populate
the array from the string.

Dim intColumn As Integer
Dim intRow As Integer
Dim intPos As Integer
Dim strArray(9, 9) As String

For intRow = 0 To 9
For intColumn = 0 To 9
intPos = intRow * 9 + intColumn + 1
strArray(intRow, intColumn) = Mid$(PuzStr, intPos, 1)
Next intColumn
Next intRow

Use

Mid$(PuzStr, intPos, 1) = strArray(intRow, intColumn)

instead of

strArray(intRow, intColumn) = Mid$(PuzStr, intPos, 1)

to repopulate the string.
 
Back
Top