A family of Microsoft word processing software products for creating web, email, and print documents.
If you have more than 25 classes, you will need to use this version:
Dim myrange As Range
Dim numrows As Long, numcols As Long
Dim arrData As Variant
Dim i As Long, j As Long, k As Long
Worksheets(1).Activate
Set myrange = Worksheets(1).Range("A1", Range("A1").End(xlDown))
numrows = myrange.Rows.Count
Set myrange = Worksheets(1).Range("A1", Range("A1").End(xlToRight))
numcols = myrange.Columns.Count
arrData = Worksheets(1).Range(Cells(1, 1), Cells(numrows, numcols))
Worksheets(2).Range("A1").Value = "Entrant"
Worksheets(2).Range("B1").Value = "Class"
k = 1
For i = 2 To UBound(arrData, 1)
For j = 2 To UBound(arrData, 2)
If arrData(i, j) <> "" Then
k = k + 1
Worksheets(2).Cells(k, 1).Value = arrData(i, 1)
Worksheets(2).Cells(k, 2).Value = j - 1
End If
Next j
Next i
Worksheets(2).Activate
It can also be used if there are less than 25 classes
--
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP, Posted via the NNTP Bridge
"loiswakeman" wrote in message news:2a66747c-9642-4e19-88bb-582976bc0b6d...
I have a spreadsheet (to manage entries in a competition) which is basically
a matrix of Xs or blanks, depending on whether the person (row header) has
entered a given class (column header).
I want to retrieve a set of value pairs of person/class for each cell that
has an X, to use in a mailmerge to print out competition entry slips. My VBA
skills are rather elementary, and I haven't found a way to do this without
creating an enormous and complicated table.
For example, fred has entered class 1 and 2, and mary has entered classes 3
and 4. I want to get a table with 4 records like fred,1; fred,2; mary,3;
mary,4; that I can use in a mailmerge.
I can't help thinking this should be simple if only I knew how! Either
Office 2003 or 2007. All clues gratefully received!
Doug Robbins - Word MVP