+ Reply to Thread
Results 1 to 8 of 8

Vba input.

  1. #1
    Registered User
    Join Date
    10-02-2019
    Location
    leicester , england
    MS-Off Ver
    13
    Posts
    39

    Vba input.

    Hi, I'd like to create a quick method of adding vba to a userform.
    The idea being I can just hit a button and insert a "part number" this will then add the code in txt box 1.(if partnumber. Value="1234" then msgbox "do not use" end if.
    We have to add a few of these due to quality risks.
    Any idea if the button idea is possible.

    Cheers
    Shaun.

  2. #2
    Valued Forum Contributor saravnepali's Avatar
    Join Date
    01-14-2019
    Location
    Sydney Australia
    MS-Off Ver
    2010
    Posts
    447

    Re: Vba input.

    Not quite clear where you would like to get the "part number" from - i assume its from some cells Say A1

    Can we not use a simple command button on the form and put this code in there
    Please Login or Register  to view this content.
    If you think someone helped you, click on the "* Add Reputation" as a way to say thank you.

    If your problem is solved, go to Thread Tools and select Mark This Thread Solved

  3. #3
    Registered User
    Join Date
    10-02-2019
    Location
    leicester , england
    MS-Off Ver
    13
    Posts
    39
    Quote Originally Posted by saravnepali View Post
    Not quite clear where you would like to get the "part number" from - i assume its from some cells Say A1

    Can we not use a simple command button on the form and put this code in there
    Please Login or Register  to view this content.
    OK so some more thought into this.
    Is it possible to have a code withtin the txtbox that will allow me to look up values in a range on a networked excel file. If it matches the value in the range from the txtbox a msgbox pops up with a statement. The statement will also be pulled from the networked excel sheet next to the fist value it found.
    So if value 0987 is matched then msg check width or if value12 is found msg check height.
    Could this work.

  4. #4
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,453

    Re: Vba input.

    Administrative Note:

    Please don't quote entire posts unnecessarily. They clutter threads and make them hard to read.
    Use the "Quick reply" instead
    Thanks

  5. #5
    Forum Contributor
    Join Date
    07-01-2018
    Location
    Adelaide, South Australia
    MS-Off Ver
    Office 365, & Excel 2016 on windows 10, & 14.7 for mac, & Excel 2015 for mac
    Posts
    173

    Re: Vba input.

    I'm going to start with a cell formula approach, then give the vba equivalent.

    The easiest place to start would be to start with a reference table that contains your logic.

    ie in columns
    "A" "B"
    1223 "Check Width"
    1234 "Do Not Use"
    1134 "Use with caution"

    Lets say that the part number is given in cell "C1".
    If you use a cell to place your text messages you could use the formula
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    If you wanted that as a vba code, such as a function returning a text, the same approach would work
    Please Login or Register  to view this content.
    Or using a vba error handling approach
    Please Login or Register  to view this content.
    hence whenever if you want to set the warning in textbox2 when the value of textbox1 changes in a userform
    Please Login or Register  to view this content.
    I hope that this helps
    Last edited by truk2; 11-26-2019 at 08:42 AM. Reason: Spotted an error

  6. #6
    Valued Forum Contributor saravnepali's Avatar
    Join Date
    01-14-2019
    Location
    Sydney Australia
    MS-Off Ver
    2010
    Posts
    447

    Re: Vba input.

    Try this

    If it doesn't work please attach the spreadsheet
    Please Login or Register  to view this content.
    Last edited by saravnepali; 11-26-2019 at 05:28 PM.

  7. #7
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,453

    Re: Vba input.

    @saravnepali
    If it doesn't work please send me the spreadsheet
    Please do not ask members to send information to you personally. All information on this forum must stay public and accessible to all our members.

  8. #8
    Valued Forum Contributor saravnepali's Avatar
    Join Date
    01-14-2019
    Location
    Sydney Australia
    MS-Off Ver
    2010
    Posts
    447

    Re: Vba input.

    Apologies

    I still meant through the forum.

    I will try to maintain the wording accordingly.

+ 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. Need function to Populate column adjacent to input cell based off input.
    By cooperjb12 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-07-2017, 07:22 PM
  2. Data Input Form with number of line items based on user input
    By j_gideon in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-25-2013, 02:54 PM
  3. [SOLVED] input date column A, increment B, select blank cell in D and input time. in a macro
    By jeffstu in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-19-2012, 11:19 AM
  4. Cells selecting a word input depending on input of another cell
    By ceeje25 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-14-2012, 07:08 AM
  5. [SOLVED] Macro to manually input which field (column) to autofilter on using an input prompt
    By rin in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-21-2012, 09:35 AM
  6. Automatic Formula Input Based on User Input Using a Macro
    By Drayloc in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-03-2012, 12:10 PM
  7. Using text box input to lookup number and replace based on user input into new column
    By harl3y412 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-28-2011, 03:15 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