+ Reply to Thread
Results 1 to 10 of 10

Userform popup when entry in cell is specific

  1. #1
    Registered User
    Join Date
    10-26-2011
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2013
    Posts
    62

    Userform popup when entry in cell is specific

    I have a worksheet where I enter in certain flight information. I have different pay item codes (FT=Flight Time, AV=Daily Availability, etc) that are entered. I would like to have a pop up form appear when the "FT" pay item code is entered. The form would include start time, end time, start from, end to, # of passengers, cargo payload, and mission code. When the ok button is push it would enter in this information on that particular line, and then disappear until the next time FT is entered. Is this a pipe dream or can it be down? Can anyone help me with this? Thanks.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,749

    Re: Userform popup when entry in cell is specific

    It can be done. The strategy is to use the Worksheet_Change event. Something like this would be put in the module for the sheet where this data is entered. You also have to have a way to communicate to the form what row this data is on. I would recommend a Sub in your form. See below.

    In the sheet module:
    Please Login or Register  to view this content.
    Then at the top of the code for your userform:
    Please Login or Register  to view this content.
    Then the code for UserForm_Activate will refer to FTRow as the row number to populate.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    10-26-2011
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2013
    Posts
    62

    Re: Userform popup when entry in cell is specific

    I started a sample worksheet to work on and have created the userform. But I am stuck from here. Can you help?

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,749

    Re: Userform popup when entry in cell is specific

    Sure. Attach your file.

  5. #5
    Registered User
    Join Date
    10-26-2011
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2013
    Posts
    62

    Re: Userform popup when entry in cell is specific

    Here is my example.
    Attached Files Attached Files
    Last edited by rpcoates1956; 08-23-2017 at 02:56 PM.

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,749

    Re: Userform popup when entry in cell is specific

    What you have done is much different than what you described in your first post. Originally you said you wanted to detect if the user types in FT, then bring up a form for them to complete the record. What you have implemented is to bring the form up when the user presses a button, and then complete the record. That's fine too, but I don't see what you need help with.

  7. #7
    Registered User
    Join Date
    10-26-2011
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2013
    Posts
    62

    Re: Userform popup when entry in cell is specific

    I started with the basics of creating a userform and attached it to a button to make sure it would work. Now I need to get it to pop up when the cells in column A has "FT". I have been trying the codes you suggested but I can not get it to work.

  8. #8
    Registered User
    Join Date
    10-26-2011
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2013
    Posts
    62

    Re: Userform popup when entry in cell is specific

    I started with the basics of creating a userform and attached it to a button to make sure it would work. Now I need to get it to pop up when the cells in column A has "FT". I have been trying the codes you suggested but I can not get it to work.

  9. #9
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,749

    Re: Userform popup when entry in cell is specific

    OK, I had to modify the code a bit to fit what you are doing. I preserve the ability to open the form by pressing the button.

    You have several undeclared variables I strongly recommend to everyone that they declare variables. Doing so prevents a lot of bug and runtime errors. I added Option Explicit statements.

    Please Login or Register  to view this content.
    If the form was opened by the user typing FT into a row, the Worksheet_Change will set FTRow. Otherwise FTRow will be 0. The form uses FTRow if it has been set, otherwise it uses your existing code to find the last row. That works but just FYI a more conventional way to find the last row is

    Please Login or Register  to view this content.

  10. #10
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,909

    Re: Userform popup when entry in cell is specific

    Another possibility is to use the Userform.Tag property to store the rownumber that needs to be filled.
    Attached Files Attached Files
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

+ 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. [SOLVED] Enter data into a userform text box to show in a specific cell in a specific worksheet
    By Stevecraig211 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-10-2016, 10:02 AM
  2. [SOLVED] Popup userform when click cell
    By amein in forum Excel General
    Replies: 7
    Last Post: 11-04-2015, 03:45 AM
  3. If Textbox in UserForm contains a specific entry then display data from a worksheet
    By tigerdel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-05-2014, 08:45 AM
  4. VBA to Select 1st Entry in External Popup
    By thesonofdarwin in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-14-2014, 05:57 AM
  5. [SOLVED] popup calendar when clicking on cell in userform
    By Spritz in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-19-2013, 04:08 PM
  6. Replies: 3
    Last Post: 07-06-2011, 08:25 PM
  7. Replies: 5
    Last Post: 04-08-2010, 01:01 AM

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