analyzing poll data

U

ulfb

I need a vb macro that:
- finds all respondents that choose option 3 for question 20
- then copies all questions/options for those respondents to a new sheet

This is above my skills - any assistance will be higly appreciated
Thank you
Ulf


ReplyId QuestNo QuestAltNo
79 10 6
79 20 3
79 30 1
79 40 2
80 10 9
80 20 5
80 30 4
80 40 3
 
M

mroby

Assuming that your worksheet starts in cell A1, this should get you started.
You will have to make sure you have the correct cell selected in sheet2
before you run this.

Sub Macro1()
Range("A2").Select
Do Until ActiveCell = ""
If ActiveCell.Offset(0, 2) = 3 Then
ActiveCell.Range("A1:C1").Select
Selection.Copy
Sheets("Sheet2").Select
ActiveSheet.Paste
ActiveCell.Offset(1, 0).Select
Sheets("Sheet1").Select
ActiveCell.Offset(1, 0).Select
Else: ActiveCell.Offset(1, 0).Select
End If
Loop
End Sub

Hopefully this will get you started.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top