Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,522
Default separate questions and answers of a test

On Wednesday, September 5, 2012 7:48:08 AM UTC-5, Serdar Olgun wrote:
I want to separate questions and choices of a test.little sample of file is

http://studyenglishgrammar.net/test.xlsx


I think you will like this

Option Explicit
Option Private Module

Sub FixTestQuestionsSAS()
Dim i As Long
Dim c As Integer
Dim ml As String
Dim x As Long
Dim mr As Range
Dim mrr As Long

Application.ScreenUpdating = False
For i = Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1
For c = 69 To 65 Step -1
ml = Chr(c) & ")"
x = InStrRev(Cells(i, 1), ml)
'MsgBox x

If x 0 Then
'MsgBox Chr(c) & " found in row " & i & " in position " & x
Range("b2").Insert
Range("b2").Value = Mid(Cells(i, 1), x, 256)
'MsgBox Left(Cells(i, 1), x)
Cells(i, 1) = Left(Cells(i, 1), x - 1)
ElseIf Not IsNumeric(Left(Cells(i, 1), 1)) Then
Cells(i - 1, 1) = Cells(i - 1, 1) & " " & Cells(i, 1)
Cells(i, 1).Clear
End If

Next c

Next i
'line em up
For i = Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1
If Cells(i, 1) < "" Then
Set mr = Columns("B").Find(What:="A)", After:=Cells(i - 1, 2), LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext)
If Not mr Is Nothing Then mrr = mr.Row
'MsgBox mrr
Cells(i, 1).Cut Destination:=Cells(mrr, 1)
End If
Next i

Columns.AutoFit
Application.ScreenUpdating = True
End Sub

Sub GetRawData()
Columns("A:C").ClearContents
Sheets("Sayfa1").Range("A1:A15").Copy Range("a1")
End Sub
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
separate questions and answers of a test Don Guillett[_2_] Excel Discussion (Misc queries) 1 September 5th 12 03:10 PM
Answers to questions posing more questions in a workbook sbelle1 Excel Worksheet Functions 2 August 8th 09 01:02 AM
How to put test questions then student answers and get % correct Kathy Excel Worksheet Functions 2 July 23rd 07 03:32 PM
Calculate mean of test scores from rows of test answers RiotLoadTime Excel Discussion (Misc queries) 1 July 26th 06 05:14 PM
3 Questions - No Answers - Help me please Adam Harding Excel Programming 1 September 26th 05 06:04 PM


All times are GMT +1. The time now is 09:38 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"