+ Reply to Thread
Results 1 to 4 of 4

error in data transfer of userform w/ 3 options buttons

  1. #1
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Ky
    MS-Off Ver
    Excel 2013
    Posts
    344

    error in data transfer of userform w/ 3 options buttons

    On my userform, I have several questions with Yes/No option buttons. When my Save/Close command button is executed, I have the following code to transfer the data:


    Please Login or Register  to view this content.
    This worked fine. But now I have had to change the last question (#12) to include not only Yes/No, but a third option button, "NA".

    So I modified highlighted code above to the following (below) and changed nothing else, and I get a "Compile Error: End With without With" message. Any suggestions?

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: error in data transfer of userform w/ 3 options buttons

    Hi BlueGrass,

    Try this (code excerpt) - changes in red:
    Please Login or Register  to view this content.
    Single step through the code and make sure the 'Blue' code executes when you want it to.

    Lewis

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: error in data transfer of userform w/ 3 options buttons

    That error doesn't really have anything to do with With/End With, it's because the If statements in your code aren't quite structured correctly.

    Actually I'm not sure multiple Ifs is the best approach.

    Instead you could use a Select...Case structure, something like this.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  4. #4
    Forum Contributor
    Join Date
    04-14-2013
    Location
    Ky
    MS-Off Ver
    Excel 2013
    Posts
    344

    Re: error in data transfer of userform w/ 3 options buttons

    @LJMetzger - worked fine except I didn't need the last 'End If' statement.

    and @Norie, as usual, your advice is spot on. Thanks!

    -HeyInKy ...from the Bluegrass

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 08-26-2014, 08:44 AM
  2. Adding submit buttons to transfer data to live spreadsheet
    By LaurenP in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-26-2014, 01:46 AM
  3. combining chart userform and data transfer userform into 1 userform
    By H_Kennedy in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 01-04-2014, 07:11 AM
  4. combining chart userform and data transfer userform into 1 userform
    By H_Kennedy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-03-2014, 12:28 PM
  5. [SOLVED] Option Buttons-putting questionaire using options buttons
    By Ashman in forum Excel General
    Replies: 2
    Last Post: 07-10-2005, 04:05 PM

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