+ Reply to Thread
Results 1 to 7 of 7

Userform Creation - Checklist Yes/No with Comments

  1. #1
    Registered User
    Join Date
    11-12-2012
    Location
    Derby
    MS-Off Ver
    Excel 2007
    Posts
    3

    Userform Creation - Checklist Yes/No with Comments

    Good afternoon,

    I am new to the VBA side of Excel and have a tiny understanding of VBA. I currently have a problem in creating a list of questions with a Yes, No or N/A answer and then having a comments box at each question if required.

    What I want to do is have a basic front page with several buttons, one to open the checksheet, and one to open the raw data. (From that raw data I will produce reports/graphs)

    I have a bit of code within a userform as follows:

    'Used to put data into sheet 2

    RowCount = Worksheets("DATA").Range("B1").CurrentRegion.Rows.Count
    With Worksheets("DATA").Range("B1")
    .Offset(RowCount, 0).Value = TB_PART_NUMBER.Value
    .Offset(RowCount, 1).Value = TB_FAIR_REF.Value
    .Offset(RowCount, 2).Value = CB_MEP.Value
    .Offset(RowCount, 3).Value = DateValue(TB_DTE.Value)
    .Offset(RowCount, 4).Value = CB_REGION.Value
    .Offset(RowCount, 5).Value = OP_1.Value
    .Offset(RowCount, 6).Value = OP_3.Value
    .Offset(RowCount, 7).Value = OP_5.Value
    .Offset(RowCount, 8).Value = OP_7.Value
    .Offset(RowCount, 9).Value = OP_9.Value
    .Offset(RowCount, 10).Value = OP_11.Value
    .Offset(RowCount, 11).Value = OP_13.Value
    .Offset(RowCount, 12).Value = OP_15.Value

    End With

    Now this is putting the data where I would like it but I can only access that currently when I am in the userform and press play on the macro. I would like that code to run when a button is pressed from the front sheet.

    I don't suppose someone has a simple sheet which I could modify/copy...

    If I need to explain any better please state and I will try to.

    Regards

  2. #2
    Forum Contributor Dave H9's Avatar
    Join Date
    03-10-2011
    Location
    Manchester, England
    MS-Off Ver
    Excel 2007
    Posts
    418

    Re: Userform Creation - Checklist Yes/No with Comments

    You Should add a button to your userform and call your subroutine from that

    Please Login or Register  to view this content.
    Hope that helps

    Dave H
    - Mark your post [SOLVED] if it has been answered satisfactorily, by editing your original post using advanced mode.
    - Thank those that provided useful help, its nice and its very well appreciated...use the star on the lower left of the post

  3. #3
    Registered User
    Join Date
    11-12-2012
    Location
    Derby
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Userform Creation - Checklist Yes/No with Comments

    Hi Dave,

    Thanks for that,

    I managed to get there in the end but now I have a right problem with long code checking 100 option buttons, I want to check the buttons are all true and if so populate my database if any of them are false it needs to pop a promt up. I started putting code out in long as shown but I don't think this is the right idea at all.

    If OP_1.Value = "True" Then
    If OP_3.Value = "True" Then
    If OP_5.Value = "True" Then

  4. #4
    Forum Contributor Dave H9's Avatar
    Join Date
    03-10-2011
    Location
    Manchester, England
    MS-Off Ver
    Excel 2007
    Posts
    418

    Re: Userform Creation - Checklist Yes/No with Comments

    You could shorten with "OR"

    Please Login or Register  to view this content.
    Dave H

  5. #5
    Registered User
    Join Date
    11-12-2012
    Location
    Derby
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Userform Creation - Checklist Yes/No with Comments

    Hi Dave,

    That would help if it was only 5 options for example but I got 150 options so I was thinking is there not a possible way of doing it like so:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor Dave H9's Avatar
    Join Date
    03-10-2011
    Location
    Manchester, England
    MS-Off Ver
    Excel 2007
    Posts
    418
    Ok will have a look and get back to you tomorrow....if no one else has.

    Cheers

    Dave h

  7. #7
    Forum Contributor Dave H9's Avatar
    Join Date
    03-10-2011
    Location
    Manchester, England
    MS-Off Ver
    Excel 2007
    Posts
    418

    Re: Userform Creation - Checklist Yes/No with Comments

    Two ways spring to mind -

    1. Add a helper sheet and have your userform write true or false in a column as the data is entered. you can then use a for each i.....next i to check for false

    2. Create the long hand code in a spreadsheet using formaula and concantenate, then paste into your code (as text).

    Hope that helps, if not post an example and I'll try and sort it out.

    Dave H

+ Reply to Thread

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