Hi there,
I'm new here and not very familiair with VBA.
I've searched on the internet for many days but can't find to solve my problem.
I've an Excel Workbook with several sheets.
A sheet named "Vragenlijst" contains 20 questions. Each question has 4 option buttons (Control Toolbox) in a group.
In the second sheet named "Controlevelden" the values of the 20 aswers are registered in colom B2 to B21.
In B27 i wrote a formula: =COUNT.IF(B2:B21;">0")>=20
After the questions are aswered there will be a summary of textual answers on the sheet named "Rapportage".
I have 1 command button proceeding all the actions neccesary. After pushing the button
a macro takes a picture (with 'camera'-option in Excel) of this summary and places it on a special place on sheet "Vragenlijst"
A MsgBox is giving me a box with "You didn't anwer 1 (or more) questions" when a question has not been answers (option button not chosen). When all the question are answered: "You answered all the question".
The problem is that after "You didn't asnwer 1 (or more) questions" it continues with the next macro in VBA.
I want to go to the not answered question before going further with the VBA command.
The command button has this code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Me.ScrollArea = "A1:F132"
End Sub
Private Sub ComboBox1_Change()
End Sub
Private Sub commandbutton1_click()
checkvragen
foto
foto2
Macro2
Mail_workbook_Outlook_1
End Sub
the module (sub) 'checkvragen' has this code:
Option Explicit
Sub checkvragen()
Dim rRange As Range
Dim oCell As Variant
Dim Counter As Long
Dim Cancel As Integer
Counter = 0
Set rRange = Sheets("Controlevelden").Range("B2:B21")
For Each oCell In rRange
If oCell.Value = 0 Then
Counter = Counter + 1
End If
Next
If Counter <> 0 Then
MsgBox "U heeft " & Counter & " vraag/vragen nog niet beantwoord."
Else: MsgBox "U heeft alle vragen beantwoord."
Cancel = True
End If
End Sub
Can anyone help me please?
Bookmarks