Results 1 to 11 of 11

after msgbox go to not answered groupbox (radiobutons) before continu with next macro

Threaded View

VBAStarter after msgbox go to not... 01-18-2012, 09:53 AM
pike Re: after msgbox go to not... 01-19-2012, 05:12 AM
VBAStarter Re: after msgbox go to not... 01-19-2012, 08:09 AM
pike Re: after msgbox go to not... 01-19-2012, 03:16 PM
VBAStarter Re: after msgbox go to not... 01-21-2012, 06:51 AM
pike Re: after msgbox go to not... 01-21-2012, 07:37 AM
VBAStarter Re: after msgbox go to not... 01-21-2012, 09:40 AM
VBAStarter Re: after msgbox go to not... 01-21-2012, 11:36 AM
VBAStarter Re: after msgbox go to not... 01-21-2012, 11:33 AM
pike Re: after msgbox go to not... 01-21-2012, 08:39 PM
VBAStarter Re: after msgbox go to not... 01-22-2012, 10:39 AM
  1. #1
    Registered User
    Join Date
    01-08-2012
    Location
    Zwijndrecht, Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    20

    after msgbox go to not answered groupbox (radiobutons) before continu with next macro

    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?
    Last edited by VBAStarter; 01-22-2012 at 11:14 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1