(un)solvable problem in excel ?
First put the questions and answers in two different sheets in the same
workbook and call the question sheet "q" and the answer sheet "a"
Include a blank sheet called "qa"
Then install & run:
Sub marko()
'
' gsnuxx
'
k = 1
Set q = Sheets("q")
Set a = Sheets("a")
Set qa = Sheets("qa")
j = 1
For i = 1 To 1000
n = q.Cells(i, 1).Value
qa.Cells(k, 1).Value = n
qa.Cells(k, 2).Value = q.Cells(i, 2).Value
k = k + 1
m = n
Do
m = a.Cells(j, 1).Value
If m < n Then
Exit Do
End If
If m = "" Then
Exit Sub
End If
qa.Cells(k, 2).Value = a.Cells(j, 2).Value
If a.Cells(j, 3).Value = 0 Then
qa.Cells(k, 3).Value = "False"
Else
qa.Cells(k, 3).Value = "True"
End If
k = k + 1
j = j + 1
Loop
Next
End Sub
--
Gary''s Student - gsnu200724
"/-_-b" wrote:
Hey guys,
I have 2 xls files from one of my web quizzes (both exported from mysql in
excel format), and i'm trying to merge them in one file.
1st file example:
--------------------------------------------------
| A | B |
--------------------------------------------------
| 1 | Who was the first man on the Moon ? |
--------------------------------------------------
| 2 | The fastest animal on the planet is.. |
---
and so on...
(A column - question no., B col. - question)
2nd file example:
-------------------------------------
| A | B | C |
-------------------------------------
| 1 | John Glenn | 0 |
-------------------------------------
| 1 | Neil Armstrong | 1 |
-------------------------------------
| 1 | Yuri Gagarin | 0 |
-------------------------------------
| 2 | Turtle | 0 |
-------------------------------------
| 2 | Cheetah | 1 |
----
and so on...
(A column- question no. answers refer to, B- answers, C- 0 is false answer,
1 is true)
So i would like to merge those 2 tables in one following this sequence :
| A | B | C |
----------------------------------------------------
question no. | question | |
----------------------------------------------------
| | answer 1 | true/false|
----------------------------------------------------
| | answer 2 | true/false|
----------------------------------------------------
| | answer 3 | true/false|
----------------------------------------------------
question no. | question | |
----------------------------------------------------
| | answer 1 | true/false|
----------------------------------------------------
| | answer 2 | true/false|
----------------------------------------------------
| | answer 3 | true/false|
.....
I hope someone can help me with this one ?
Thanks in advance !
Marko
|