Creating a Survey in Excel??

tandkb

Board Regular
Joined
Dec 29, 2010
Messages
51
Office Version
  1. 365
Platform
  1. Windows
Hello,

I am looking to create a Survey inside excel. I have 45 different locations and I would like to know what locations the customer has been to. I have created a check box list of all the locations. I would like the customer to select all the locations they have been to and then on then on the next page I want it to display each location the selected with 5 questions about that location. All 5 questions are the same for each location. I dont want to list the 5 questions under each location and make them scroll through 45 locations with the 5 questions under each location I want it to populate the loctaions they selected on the first page with the questions for those locations on the 2nd page. Hope this make sense. I tried to upload some pictures to this post but could not figure out how to do that. Sorry.

Thanks for your help!
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
.
Let me know if this works for you ....

Some of the code :

Code:
Option Explicit


Sub AreYouSure()
Dim answer As Variant


answer = MsgBox("Are you sure? Once you click YES you may not return to this sheet.", vbYesNo + vbQuestion, "NO RETURN !")
  
  If answer = vbYes Then
      copyrange
   Else
     Exit Sub
    End If


End Sub
Sub RowsVisi()
Dim a As Integer
Dim Last As Integer
Dim emptyRow As Integer


Application.ScreenUpdating = False


Last = Sheet1.Range("C" & Rows.Count).End(xlUp).Row
For emptyRow = 4 To Last Step 7
Sheet1.Range(Cells(emptyRow, "A"), Cells(emptyRow, "A")).Value = ChrW(&H2713)
Next emptyRow


For a = 4 To 500
    If Worksheets("Sheet1").Cells(a, 1).Value = ChrW(&H2713) Then
        Cells(a, 1).Select
        Range(ActiveCell.Offset(0, 0), ActiveCell.Offset(6, 3)).Select
        Selection.EntireRow.Hidden = False
    End If
Next


Sheet1.Range("F1").Select
Application.ScreenUpdating = True


End Sub


Sub RowsNoVisi()
Dim a As Integer


Application.ScreenUpdating = False


For a = 4 To 500
    If Worksheets("Sheet1").Cells(a, 1).Value = ChrW(&H2713) Then
        Cells(a + 1, 1).Select
        Range(ActiveCell.Offset(0, 0), ActiveCell.Offset(4, 0)).EntireRow.Hidden = True
    End If
Next
Sheets("Sheet1").Range("A4:A500").Value = ""
Range("F1").Select
Application.ScreenUpdating = True


End Sub


Sub copyrange()
Dim LastRow As Long
Dim c As Range
Dim destRow As Long
Dim shtDest As Worksheet


Sheet2.Visible = xlSheetVisible


Set shtDest = Sheets("Sheet2")    'destination sheet


destRow = 2 'start copying to this row
 
Application.ScreenUpdating = False


With Worksheets("Sheet1")
      LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
End With


For Each c In Worksheets("Sheet1").Range("A4:A500")   ' & LastRow)
    If c.Value = ChrW(&H2713) Then
        c.Select
            Range(ActiveCell.Offset(0, 1), ActiveCell.Offset(6, 3)).Select
            Selection.Copy shtDest.Cells(destRow, 1)
    End If
    destRow = destRow + 1
Next


Application.ScreenUpdating = True


DeleteBlankRows


End Sub


Sub DeleteBlankRows()


Dim i As Integer
Dim rng As Range
Dim WorkRng As Range
Dim xRows As Long
On Error Resume Next


Set WorkRng = Sheets("Sheet2").Range("B1:B500")


xRows = WorkRng.Rows.Count
Application.ScreenUpdating = False


For i = xRows To 1 Step -1
    If Application.WorksheetFunction.CountA(WorkRng.Rows(i)) = 0 Then
        WorkRng.Rows(i).EntireRow.Delete XlDeleteShiftDirection.xlShiftUp
    End If
Next


Application.ScreenUpdating = True


InsertBlankRow


End Sub


Sub InsertBlankRow()
Dim rng As Range


Application.ScreenUpdating = False
  
    Set rng = Sheets("Sheet2").Range("A2")   '<-- what row do we start with ?
    While rng.Value <> ""
        rng.Offset(6).Resize(1).EntireRow.Insert    '<-- Offset = Every X Rows // Resize = How many blank rows to insert
        Set rng = rng.Offset(7)     '<-- Offset # = 6 & 3 above or 9
    Wend
Application.ScreenUpdating = True


Sheet1.Visible = xlSheetVeryHidden


End Sub


Download workbook : https://www.amazon.com/clouddrive/share/RnUlOU03dWGaoWq2lUgMiyXQxFF1FOngdGXXeDDjOsb
 
Upvote 0
.
The project in my last post would not be the final product. Some adjustments need to be made. It is currently
set up for testing purposes only as it does not retain the data the user enters.
 
Upvote 0
Awesome! So how do I need to setup the excel sheet to make it work with this code?

Do you have a sheet already built using this that I could just plug into?

Thanks so much for your help!
 
Upvote 0
.
By what method are you thinking the user should return the answers ?
 
Upvote 0
So my initial thoughts are customer would check check boxes to tell what locations and then the questions for each location would be picking an option from a drop down. For example highly satisfied, more than satisfied, satisfied, less than satisifed and hihly dis satisfied. Then each of those would be scored giving the location piced an overall score.
 
Upvote 0
.
That sounds good.

Two questions ...

- How will you deliver this workbook to the customer to complete it ?

- Once they complete the survey, how do they return it to you for analysis ?
 
Upvote 0
I currently send them a workbook so I guess I am planning on just sending them the workbook to complete. The way it works now they just send it back to me completed. I have actually been looking at online surveys but everything costs money and I dont really have a budget for something that I send out 4 times a year to 10 people to have answer.

I would love an easy way to manage the results. I was going to try and compile the data into a few graphs and charts. Not sure the best way to do that either. I can just take the scores I get and put them into a new excel file and create the info I need on a running pivot table.

Thanks so much for your help!
 
Upvote 0
.
The password for all presently is set to pw. This can be changed in the code, which requires you to search all macros.


Hopefully it is understood that you will need to enter all information regarding the Store IDs and addresses on Sheet 1.
Each new store entered must have the store line, then the five rating categories immediately below, then a blank line.
Any other layout of the stores / ratings will skew the workings of the macros.


The user will double-click the row (Sheet 1), left of the store number, to select each store. Once all the stores have
been selected, the user then clicks OK. They will have an opportunity to cancel progress at this point or continue.
Once they choose to continue, Sheet 1 is hidden and they cannot go back to change anything.


Sheet 2 is visible with the selected stores and the five rating categories to choose from. When all
ratings have been noted by double-clicking, they click OK. This reduces all rows to only the store ID and the rating
given by the user.


A message box then appears to request the workbook be emailed back to the sender, all changes to the workbook are saved,
and the workbook is protected and closed.


When you receive the workbook, it will open to Sheet 2. If you click on UNLOCK, the password request will show. Entering
the correct password unlocks the workbook and displays all sheets for your review.


If you want to reuse the workbook, on Sheet 1 clear all checkmarks in Col A. On Sheet 2 delete all rows from Row #2 and down.


Hide Sheet 2 and the workbook is ready to go again.


Or you can simply keep a 'clean version' of the workbook and email that to the next customer.


NOTE: ALWAYS maintain a clean, unused copy of the workbook as a backup. Inevitably, something will occur that will damage or
corrupt a workbook. The clean, unused version can be copied as a working version.

Code:
Option Explicit


Sub AreYouSure()
Dim answer As Variant


answer = MsgBox("Are you sure? Once you click YES you may not return to this sheet.", vbYesNo + vbQuestion, "NO RETURN !")
  
  If answer = vbYes Then
      copyrange
   Else
     Exit Sub
    End If


End Sub
Sub RowsVisi()
Dim a As Integer
Dim Last As Integer
Dim emptyRow As Integer


Application.ScreenUpdating = False


Last = Sheet1.Range("C" & Rows.Count).End(xlUp).Row
For emptyRow = 4 To Last Step 7
Sheet1.Range(Cells(emptyRow, "A"), Cells(emptyRow, "A")).Value = ChrW(&H2713)
Next emptyRow


For a = 4 To 500
    If Worksheets("Sheet1").Cells(a, 1).Value = ChrW(&H2713) Then
        Cells(a, 1).Select
        Range(ActiveCell.Offset(0, 0), ActiveCell.Offset(6, 3)).Select
        Selection.EntireRow.Hidden = False
    End If
Next


Sheet1.Range("F1").Select
Application.ScreenUpdating = True


End Sub


Sub RowsNoVisi()
Dim a As Integer


Application.ScreenUpdating = False


For a = 4 To 500
    If Worksheets("Sheet1").Cells(a, 1).Value = ChrW(&H2713) Then
        Cells(a + 1, 1).Select
        Range(ActiveCell.Offset(0, 0), ActiveCell.Offset(4, 0)).EntireRow.Hidden = True
    End If
Next
Sheets("Sheet1").Range("A4:A500").Value = ""
Range("F1").Select
Application.ScreenUpdating = True


End Sub


Sub copyrange()
Dim LastRow As Long
Dim C As Range
Dim destRow As Long
Dim shtDest As Worksheet


Sheet2.Visible = xlSheetVisible






Set shtDest = Sheets("Sheet2")    'destination sheet


destRow = 2 'start copying to this row
 
Application.ScreenUpdating = False


With Worksheets("Sheet1")
      LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
End With


For Each C In Worksheets("Sheet1").Range("A4:A500")   ' & LastRow)
    If C.Value = ChrW(&H2713) Then
        C.Select
            Range(ActiveCell.Offset(0, 1), ActiveCell.Offset(6, 3)).Select
            Selection.Copy shtDest.Cells(destRow, 1)
    End If
    destRow = destRow + 1
Next


Sheet1.Visible = xlSheetVeryHidden


Application.ScreenUpdating = True


DeleteBlankRows


End Sub


Sub DeleteBlankRows()


Dim i As Integer
Dim Rng As Range
Dim WorkRng As Range
Dim xRows As Long
On Error Resume Next


Set WorkRng = Sheets("Sheet2").Range("B1:B500")


xRows = WorkRng.Rows.Count
Application.ScreenUpdating = False




Sheets("Sheet2").Columns("A:A").EntireColumn.Hidden = True


For i = xRows To 1 Step -1
    If Application.WorksheetFunction.CountA(WorkRng.Rows(i)) = 0 Then
        WorkRng.Rows(i).EntireRow.Delete XlDeleteShiftDirection.xlShiftUp
    End If
Next


Application.ScreenUpdating = True


InsertBlankRow


End Sub


Sub InsertBlankRow()
Dim Rng As Range


Application.ScreenUpdating = False
  
    Set Rng = Sheets("Sheet2").Range("A2")   '<-- what row do we start with ?
    While Rng.Value <> ""
        Rng.Offset(6).Resize(1).EntireRow.Insert    '<-- Offset = Every X Rows // Resize = How many blank rows to insert
        Set Rng = Rng.Offset(7)     '<-- Offset # = 6 & 3 above or 9
    Wend


Application.ScreenUpdating = True


End Sub


Sub delEmpty()
Dim sht As Worksheet
Dim LastRow As Long
Dim i As Integer


Application.ScreenUpdating = False


Set sht = Sheet2


LastRow = sht.UsedRange.Rows(sht.UsedRange.Rows.Count).Row


For i = LastRow To 2 Step -1
    If IsEmpty(Cells(i, 1)) And IsEmpty(Cells(i, 3)) Then
        Cells(i, 1).EntireRow.Delete
    End If
Next i


Application.ScreenUpdating = True


ProtectAllShts


End Sub


Sub PWenter()
Dim answer As String


answer = InputBox("Enter password.", "Password Request")
  
  If answer = "pw" Then
    UnprotectAllShts
    Sheet1.Visible = xlSheetVisible
   Else
    MsgBox "Password Incorrect.", vbCritical & vbOKOnly, "Password Error"
     Exit Sub
    End If


End Sub


Sub ProtectAllShts()
Dim ws As Worksheet
Dim pwd As String


pwd = "pw" ' Put your password here
For Each ws In Worksheets
    ws.Protect Password:=pwd
Next ws


MsgBox "Please email this workbook to sender. Thank you !" & vbNewLine & "The workbook will now close.", vbInformation, "Return Workbook"


Workbooks("Survey Store Visits.xlsm").Close SaveChanges:=True


End Sub


Sub UnprotectAllShts()
Dim ws As Worksheet
Dim pwd As String


pwd = "pw" ' Put your password here
For Each ws In Worksheets
    ws.Unprotect Password:=pwd
Next ws
End Sub


Sub WBOpenUnprotectAllShts()
Dim ws As Worksheet
Dim pwd As String


pwd = "pw" ' Put your password here
For Each ws In Worksheets
    ws.Unprotect Password:=pwd
Next ws
End Sub


Also ... there is at least one occurrence of the present workbook name in the macro coding. If you change the name of the workbook, you will need to edit the name in the macro/s as well.

Download workbook : https://www.amazon.com/clouddrive/share/q74IAXJsv9fM5QjmkAV5R4k4okvtXWJFJPvRU5rzVDi
 
Upvote 0
Thank you so much! This is awesome!

I have a few questions.
Can I remove column B on Sheet 1.
Can I change the Address/Location header to just Location? Also can I hide every row between the locations so there are no spaces.

So Under each location where you have Highly Satisfied, More than Satisfied, Satisdifed ect. I would like each of those lines to be questions Like Cleaniness, Service, Total exeperience and would you reccomend.

Then on sheet 2 I want those questions to be under the location and then where you have the double click I want a drop down menu for each of those questions with the option to select Highly Satisfied More than satisfied ect.....

I would then love a simple report page that lists the locations they picked with the score of each answer and an avg score maybe for example the report page would look like this.

Store 1 - 4 4 3 2 3.25
Store 4 - 3 2 4 1 2.5

That way I can just copy and paste that info into a master survey results sheet and I will create charts and graphs with that data.

I know I am asking a lot. Thanks so much for your help!
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top