ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   analyzing poll data (https://www.excelbanter.com/excel-programming/318731-analyzing-poll-data.html)

ulfb

analyzing poll data
 
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

mroby

analyzing poll data
 
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.


"ulfb" wrote:

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



All times are GMT +1. The time now is 05:36 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com