traversing across columns in VBA

  • Thread starter Thread starter Peter Bailey
  • Start date Start date
P

Peter Bailey

I have the following:

F | G| H | I | J |K .... to T Sum of Error
1 2 4 3 1 1 1 3
2 1 1 1 2 4 1 2
3 1 1 1 1 1 1 0
4
..
The numbers represent error codes. Up to now I have created a vba macro that
creates an array for each learner with the number of errors they got.

I now need to match the error codes against another table in another
worksheet.

How do I traverse from F to S ? ie what methods are available and the syntax
please.

Going down to get the error was easy as I created an index and did x + 1 and
concatenate this to the column Letter but I am not sure how to traverse
across.

Regards in advance
Peter
 
I don't understand what it means to 'traverse from F to S' or what
exactly you did with x+1 and concatenation. But if you have a number
in the 'Sum of error' column and you want to translate that error into
some other code based on a table, check out the VLOOKUP function. It's
an XL function that can be used in VBA through
Application.Worksheetfunction.VLookup()

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
 
Column F is 6; column S is 19

For R = 1 To 20
For C = 6 To 19
'do something here with the value in column C
T = T + Cells(R, C).Value
Next C
Next R
 
Tushar

You tried to help me but that wasnt what I meant traverse in english means
to move across either up or down. I did the down part ex A1, A2, A3 A4
getting the contents of the cell as I went.

I now want to go across the columns ex A1, B1, C1 and get the data in the
cell.

Regards
Peter
 
I found the answer myself with :

For intx = 0 To LearnerCount - 1 ' for each learner change row offset
For Each Cell In Range("F10:S10") 'set range
value = Cell.Offset(intx, 0).value ' get the value
Next

Next intx
regards to forum
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top