VBA Radio Button with Msgbox flowchart of questions Help!

moebuenavente

New member
Joined
Sep 6, 2017
Messages
2
Reaction score
0
Points
0
Hi I'm new to VBA but not new to programming. I'm trying to work on a form that if the user clicks on one of the radio buttons that is considered "below standard" it will prompt the user a series of questions to determine an outcome. The "Questions and Guidance Statements - noise tool" is the flow chart. I have also attached my spreadsheet and the word doc for it to transfer the data into a report. Anyways, I was trying to figure out how to create a loop because for example Measurement/Dosimetry it asks the user 3 questions and if the answer is No on the 3rd question it still needs to go to the 4th question and depending on what the user chooses it will copy the result of the 3rd question and basically concatenate it with the 6th question result. I know it's super confusing! That's why I'm getting confused on how to code it.

Feel free to unhide my columns & sheets to see all of the "behind the scenes" action! PLEASE HELP ME!!!!!!!!!!!!


View attachment Noise Qualitative Assessment Tool Andromeda_1.0.xlsmView attachment Noise Risk Qualitative Assessment.docxView attachment Questions and Guidance Statements - noise tool.docx
 
Hi p45cal, my apologies! I read the article you provided and I completely understand. Again my sincerest apologies, this is my first time ever joining a forum and willingly asking for help. I usually tend to suffer in silence but am learning how to ask for help. This definitely puts things in perspective when asking for help. I am going to delete all of the other posts except the one that was answered.

Again, thank you for informing me of the rules - I am new to posting anything ever on any site so this is very helpful knowledge to know and it will most definitely be taken seriously. Thank you.
 
Not sure if I've followed what you want, but for Measurement/Dosimetry try:
Code:
Sub ProgressingMeasurementDosimetry1()
With Worksheets("Qualitative Assessment")
  Set Destn = .Range("C127:D127")
  If Range("C24").Value = 2 Then
    ConductANoiseSurvey = True
    If MsgBox("Has a noise survey been completed?", vbYesNo + vbQuestion, "Measurement/Dosimetry") = vbYes Then
      If MsgBox("Is the Survey documented?", vbYesNo + vbQuestion, "Measurement/Dosimetry") = vbYes Then
        If MsgBox("Is the Survey current (last 5 years; no operational/ equipment changes, good PM, credible data)?", vbYesNo + vbQuestion, "Measurement/Dosimetry") = vbYes Then
          'no guidance:
          ConductANoiseSurvey = False
        End If
      End If
    End If

    IdentifyNoiseExposureLevels = True
    If MsgBox("Have noise exposure levels been identified?", vbYesNo + vbQuestion, "Measurement/Dosimetry") = vbYes Then
      If MsgBox("Is the analysis/ determination documented?", vbYesNo + vbQuestion, "Measurement/Dosimetry") = vbYes Then
        If MsgBox("Is the analysis/ determination current (last 5 years; no operational/ equipment changes, good PM, credible data)?", vbYesNo + vbQuestion, "Measurement/Dosimetry") = vbYes Then
          'no guidance:
          IdentifyNoiseExposureLevels = False
        End If
      End If
    End If
    Select Case True
      Case ConductANoiseSurvey And IdentifyNoiseExposureLevels
        .Range("C114:D114").Copy Destn
      Case ConductANoiseSurvey
        .Range("C115:D115").Copy Destn
      Case IdentifyNoiseExposureLevels
        .Range("C121:D121").Copy Destn
      Case Else
        .Range("C126:D126").Copy Destn
        'or  .Range("C113:D113").Copy Destn
        'or  .Range("C112:D112").Copy Destn
        'whichever.
    End Select
  End If
End With  'Worksheets("Qualitative Assessment")
End Sub

Elsewhere, the likes of this:
Code:
Sub BICMeasurementDosimentry1()
Dim Shp As Shape
For Each Shp In ActiveSheet.Shapes
  If Shp.Type = msoFormControl Then
    Worksheets("Qualitative Assessment").Range("C112:D112").Copy _
        Destination:=Worksheets("Qualitative Assessment").Range("C127:D127")
  End If
Next Shp
End Sub
seems a tad unnecessary; why loop through 40 shapes copying the same thing 40 times?! I would have thought you could forget the shapes and just have:
Code:
Sub BICMeasurementDosimentry1()
Worksheets("Qualitative Assessment").Range("C112:D112").Copy Worksheets("Qualitative Assessment").Range("C127:D127")
End Sub

Now don't forget to update all other threads with links to all other threads!! It's not hard.
 
Last edited:
Back
Top