In Column A, there is data which contain question, choices and other data. The choices starts with A B C D in each row. I just need to copy the CHOICES and QUESTION and paste into next columnB. Sample data as shown below. I tried the below code from this site, but it copies only the first letter of cell value not the entire cell and also it doen not copy all values from the columA.
ColA ColB
Program Math
Exercise 3-24
This is a sample test
Select the correct answer
1 Question 1 Question
A choice-1 A choice-1
B choice-2 B choice-2
C choice-3 C choice-3
D choice-4 D choice-4
Program Math
Exercise 5-12
This is a sample test
Select the correct answer
2 Question 2 Question
A choice-1 A choice-1
B choice-2 B choice-2
C choice-3 C choice-3
D choice-4 D choice-4
Program Math
Exercise 2-14
This is a sample test
Select the correct answer
1 Question
A choice-1
B choice-2
C choice-3
D choice-4
Sub PHOTOEYE_2()
Dim c As Range
Dim Source As Worksheet
Dim Target As Worksheet
Set Source = ActiveWorkbook.Worksheets("Sheet2")
Set Target = ActiveWorkbook.Worksheets("Sheet3")
For Each c In Source.Range("A1:A" & Source.Cells(Rows.Count, 1).End(xlUp).Row)
If c = "A " Then
'c.EntireRow.Copy
c.Copy
Target.Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlPasteValues
End If
Next c
End Sub
New contributor
Siraj Syed is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.