+ Reply to Thread
Results 1 to 6 of 6

How can I reset an Excel form that has radio buttons.

  1. #1
    JaxPM
    Guest

    How can I reset an Excel form that has radio buttons.

    using version 2003.

  2. #2
    Tom Ogilvy
    Guest

    RE: How can I reset an Excel form that has radio buttons.

    Dim ctrl as Control
    for each ctrl in Userform1.Controls
    if typeof ctrl is MSforms.OptionButton then
    ctrl.Value = False
    end if
    Next

    --
    Regards,
    Tom Ogilvy


    "JaxPM" wrote:

    > using version 2003.


  3. #3
    JaxPM
    Guest

    RE: How can I reset an Excel form that has radio buttons.

    I'm a newbie. I tried pasting the macro 'as is' and assigning a button. It
    didn't work. What am I doing wrong?

    "Tom Ogilvy" wrote:

    > Dim ctrl as Control
    > for each ctrl in Userform1.Controls
    > if typeof ctrl is MSforms.OptionButton then
    > ctrl.Value = False
    > end if
    > Next
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    > "JaxPM" wrote:
    >
    > > using version 2003.


  4. #4
    Tom Ogilvy
    Guest

    RE: How can I reset an Excel form that has radio buttons.

    I had a userform with three optionbuttons. I place a commandbutton on the
    sheet (commandbutton2). I then double clicked on the command button (in the
    vbe in design mode) and it took me to

    Private Sub CommandButton2_click()

    End sub

    I then altered that code to:

    Private Sub CommandButton2_Click()
    Dim ctrl As Control
    For Each ctrl In UserForm1.Controls
    If TypeOf ctrl Is MSforms.OptionButton Then
    ctrl.Value = False
    End If
    Next

    End Sub

    then I showed the userform and clicked one of the optionbuttons. I clicked
    commandbutton2 and the optionbuttons were all unselected.

    --
    Regards,
    Tom Ogilvy


    "JaxPM" wrote:

    > I'm a newbie. I tried pasting the macro 'as is' and assigning a button. It
    > didn't work. What am I doing wrong?
    >
    > "Tom Ogilvy" wrote:
    >
    > > Dim ctrl as Control
    > > for each ctrl in Userform1.Controls
    > > if typeof ctrl is MSforms.OptionButton then
    > > ctrl.Value = False
    > > end if
    > > Next
    > >
    > > --
    > > Regards,
    > > Tom Ogilvy
    > >
    > >
    > > "JaxPM" wrote:
    > >
    > > > using version 2003.


  5. #5
    JaxPM
    Guest

    RE: How can I reset an Excel form that has radio buttons.

    I get this error msg:
    "User-defined type not defined"

    "Tom Ogilvy" wrote:

    > I had a userform with three optionbuttons. I place a commandbutton on the
    > sheet (commandbutton2). I then double clicked on the command button (in the
    > vbe in design mode) and it took me to
    >
    > Private Sub CommandButton2_click()
    >
    > End sub
    >
    > I then altered that code to:
    >
    > Private Sub CommandButton2_Click()
    > Dim ctrl As Control
    > For Each ctrl In UserForm1.Controls
    > If TypeOf ctrl Is MSforms.OptionButton Then
    > ctrl.Value = False
    > End If
    > Next
    >
    > End Sub
    >
    > then I showed the userform and clicked one of the optionbuttons. I clicked
    > commandbutton2 and the optionbuttons were all unselected.
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    > "JaxPM" wrote:
    >
    > > I'm a newbie. I tried pasting the macro 'as is' and assigning a button. It
    > > didn't work. What am I doing wrong?
    > >
    > > "Tom Ogilvy" wrote:
    > >
    > > > Dim ctrl as Control
    > > > for each ctrl in Userform1.Controls
    > > > if typeof ctrl is MSforms.OptionButton then
    > > > ctrl.Value = False
    > > > end if
    > > > Next
    > > >
    > > > --
    > > > Regards,
    > > > Tom Ogilvy
    > > >
    > > >
    > > > "JaxPM" wrote:
    > > >
    > > > > using version 2003.


  6. #6
    Tom Ogilvy
    Guest

    Re: How can I reset an Excel form that has radio buttons.

    I had a userform with three optionbuttons. I place a commandbutton on the
    sheet (commandbutton2). I then double clicked on the command button (in the
    vbe in design mode) and it took me to

    Private Sub CommandButton2_click()

    End sub

    I then altered that code to:

    Private Sub CommandButton2_Click()
    Dim ctrl As Control
    For Each ctrl In UserForm1.Controls
    If TypeOf ctrl Is MSforms.OptionButton Then
    ctrl.Value = False
    End If
    Next

    End Sub

    then I showed the userform and clicked one of the optionbuttons. I clicked
    commandbutton2 and the optionbuttons were all unselected.

    --
    Regards,
    Tom Ogilvy

    "JaxPM" <JaxPM@discussions.microsoft.com> wrote in message
    news:28BB9104-99D9-41E5-8E1B-CD7D013BE729@microsoft.com...
    > I get this error msg:
    > "User-defined type not defined"
    >
    > "Tom Ogilvy" wrote:
    >
    > > I had a userform with three optionbuttons. I place a commandbutton on

    the
    > > sheet (commandbutton2). I then double clicked on the command button (in

    the
    > > vbe in design mode) and it took me to
    > >
    > > Private Sub CommandButton2_click()
    > >
    > > End sub
    > >
    > > I then altered that code to:
    > >
    > > Private Sub CommandButton2_Click()
    > > Dim ctrl As Control
    > > For Each ctrl In UserForm1.Controls
    > > If TypeOf ctrl Is MSforms.OptionButton Then
    > > ctrl.Value = False
    > > End If
    > > Next
    > >
    > > End Sub
    > >
    > > then I showed the userform and clicked one of the optionbuttons. I

    clicked
    > > commandbutton2 and the optionbuttons were all unselected.
    > >
    > > --
    > > Regards,
    > > Tom Ogilvy
    > >
    > >
    > > "JaxPM" wrote:
    > >
    > > > I'm a newbie. I tried pasting the macro 'as is' and assigning a

    button. It
    > > > didn't work. What am I doing wrong?
    > > >
    > > > "Tom Ogilvy" wrote:
    > > >
    > > > > Dim ctrl as Control
    > > > > for each ctrl in Userform1.Controls
    > > > > if typeof ctrl is MSforms.OptionButton then
    > > > > ctrl.Value = False
    > > > > end if
    > > > > Next
    > > > >
    > > > > --
    > > > > Regards,
    > > > > Tom Ogilvy
    > > > >
    > > > >
    > > > > "JaxPM" wrote:
    > > > >
    > > > > > using version 2003.




+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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