+ Reply to Thread
Results 1 to 9 of 9

User Form Coding Inquiry

  1. #1
    Registered User
    Join Date
    06-03-2014
    Posts
    9

    Post User Form Coding Inquiry

    Hey all,
    I am new to excel with little VB experience. I plan on beginning online tutorials soon. I have a vision right now and need advice on how to proceed. To make simple, I work with engineers who need specific forms for certain tests. I have all the test forms in difference excel sheets in one file. I'd like to make a userform that takes in two forms of data.

    The first is a checkbox - Suppose "test A" is checked, it will then take that excel sheet and bring it over to a new excel sheet. When multiple tests are needed, they will need a new sheet that is unique with specific sheets.

    next is a set of data that is filled out in text boxes that then fill in certain other areas. So if userform asks for client name, they put in the name and it populates that to the header....

    This is simple commands but have no clue on how to go about it YET. So please help me out. Thanks all! I'll be a contributor once I learn more!

  2. #2
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,192

    Re: User Form Coding Inquiry

    Start here: (below in next post)

  3. #3
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,192

    Re: User Form Coding Inquiry

    Start with the attached file w macro.
    Pick Tests to take.xlsm

  4. #4
    Registered User
    Join Date
    06-03-2014
    Posts
    9

    Re: User Form Coding Inquiry

    Ranman256 that was fast!
    I'm beginning to edit that to accommodate all my testing. Thank you! Was this a template somewhere or did you write it? Can you recommend tutorials with VB and these sorts of operations?

  5. #5
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,192

    Re: User Form Coding Inquiry

    I wrote it.

    To learn VBA, the best way is to record a macro and click your steps. (not for your program...yours was a bit more difficult)
    But by recording then viewing the code, you can see how the excel objects work.
    Also, a beginners guide to BASIC will help on constructing loops, and using variables.

    Good luck.

  6. #6
    Registered User
    Join Date
    06-03-2014
    Posts
    9

    Re: User Form Coding Inquiry

    Ok Ranman.
    I tried to make more checkboxes to allow for more tests. I couldnt determine how to do so.

    Is there a way to create the userform that looks prettier to do the same thing. I can't find any code via google that meets my needs to allow for checkboxes to be checked and then the command button to unload it. I looked at the code you created and (as a newbie) was unable to decipher it. It look as if there was only code for checkbox A and C but none for B, yet it still worked.

    I imagine that each userform checkbox would have only a few lines of code that use the logic of "If true, select "sheetA", copy "SheetA", Send to workbook2" Yes?

    TL;DR, unable to modify your code to fit my needs :/

  7. #7
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,192

    Re: User Form Coding Inquiry

    Did you assign each checkbox to their cells?
    When you right-click the checkbox, it shows the CELL LINK property.
    The check box value is put here (in Z column) Y col has the test name.
    The app scans these columns.

  8. #8
    Registered User
    Join Date
    06-03-2014
    Posts
    9

    Re: User Form Coding Inquiry

    Actually what I just found that works is this :

    Dim WB As Workbook

    If CheckBox1.Value = True Then
    sheets("PQC 1001").Copy
    Set NewBook = Workbooks.Add
    With NewBook
    End With
    Selection.PasteSpecial Paste:=xlPasteColumnWidths, Operation:=xlNone, _
    SkipBlanks:=False, Transpose:=False
    Else: CheckBox1.Value = False
    End If

    If CheckBox2.Value = True Then
    sheets("PQC 1002").Copy
    Selection.PasteSpecial Paste:=xlPasteColumnWidths, Operation:=xlNone, _
    SkipBlanks:=False, Transpose:=False
    Else: CheckBox2.Value = False
    End If

    End Sub

    Sub CommandButton2_Click()
    Unload Me
    End

    I think we may have been using two different avenues...I dont know enough to know.

    Now i'm just trying to add text boxes to add data to the header of a workbook....

  9. #9
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,192

    Re: User Form Coding Inquiry

    That requires code. Mine did not. But whatever works for ya!

+ 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. User Form Coding Into Cells
    By NaomiDawn in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-05-2013, 05:13 AM
  2. User Form VBA coding to enter, edit and add new records
    By SGS in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-22-2012, 03:59 AM
  3. User Form Coding problem
    By Shazz in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-15-2009, 06:13 AM
  4. Coding a formula on a user form
    By ducecoop in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-08-2008, 07:57 PM
  5. User Form Coding
    By bern in forum Excel General
    Replies: 0
    Last Post: 09-06-2005, 11:51 AM

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