Hi,
The first thing to do would be to look at the code in the workbook - see also below and see whether you can get the basic gist of what it's doing. I think it should be reasonably intuitive but thereagain I've been doing this stuff for more years than I care to remember.
However I wrote the code so that it could automatically cater for any number of questions and responses. There are two things I HAVEN'T done yet and which would be needed to completely generalise the system.
1. You can see I jump over the line in the code that inserts 5 rows at the top. That's not necessary now that they have been added and I should perhaps have deleted that code altogether. (I tend to use this approach to skip code as I'm developing something). I intended that in the real world system the formula in rows 1:4 of your data sheet would already be there and the macro would prompt you to select a file with a new set of data, and the macro would copy that data after clearing the old data into the range starting at A6.
2. The basic formula in B1:B4 is named "form1". The intention was that whenever a new set of data is loaded the macro would copy that formula across as many columns as necessary
Sub OrganiseData()
Dim lColumns As Long, lRows As Long, stItem As String, stScore As String, lCount As Long, x As Long
lRows = Sheet1.Range("A6").CurrentRegion.Rows.Count - 1
lColumns = Sheet1.Range("A6").Cells(1, Columns.Count).End(xlToLeft).Column - 1
GoTo jump
Sheet1.Range("A1:A5").EntireRow.Insert
jump:
For x = 1 To lColumns
With Sheet1
stItem = .Range("B2").Cells(1, x)
stScore = .Range("B3").Cells(1, x)
lCount = .Range("B4").Cells(1, x)
End With
With Sheet3.Range("A" & Rows.Count).End(xlUp)
.Cells(2, 1) = stItem
.Cells(2, 2) = stScore
.Cells(2, 3) = lCount
End With
Next x
End Sub
Bookmarks