+ Reply to Thread
Results 1 to 20 of 20

im trying to get a message to pop up when button is pressed and nothing is in listbob

  1. #1
    Forum Contributor
    Join Date
    01-27-2015
    Location
    New hampshire
    MS-Off Ver
    excel 2013
    Posts
    143

    im trying to get a message to pop up when button is pressed and nothing is in listbob

    im trying to get a message to pop up when commandbutton2 is pressed and there is nothing in listbox1 that says "view data first".. please help

  2. #2
    Registered User
    Join Date
    01-09-2014
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: im trying to get a message to pop up when button is pressed and nothing is in listbob

    I am guessing that command button is embed in worksheet. If it is so, then enable design mode under developer tab and then right click on button,
    Click on viewcode and enter the following between private sub and end sub:


    Please Login or Register  to view this content.
    Last edited by alansidman; 02-28-2015 at 08:19 PM.

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2403 Win 11 Home 64 Bit
    Posts
    23,810

    Re: im trying to get a message to pop up when button is pressed and nothing is in listbob

    MDembla



    Code Tags Added
    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (Because you are new to the forum, I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  4. #4
    Forum Contributor
    Join Date
    01-27-2015
    Location
    New hampshire
    MS-Off Ver
    excel 2013
    Posts
    143

    Re: im trying to get a message to pop up when button is pressed and nothing is in listbob

    The listbox is in userform1 and the command button is in the form

  5. #5
    Forum Contributor
    Join Date
    01-27-2015
    Location
    New hampshire
    MS-Off Ver
    excel 2013
    Posts
    143

    Re: im trying to get a message to pop up when button is pressed and nothing is in listbob

    any ideas on how to get this to work in userform?

  6. #6
    Registered User
    Join Date
    01-09-2014
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: im trying to get a message to pop up when button is pressed and nothing is in listbob

    Right click on the command button in userform, click view code and enter this between private sub and end sub:

    Please Login or Register  to view this content.
    Last edited by MDembla; 02-28-2015 at 10:12 PM.

  7. #7
    Forum Contributor
    Join Date
    01-27-2015
    Location
    New hampshire
    MS-Off Ver
    excel 2013
    Posts
    143

    Re: im trying to get a message to pop up when button is pressed and nothing is in listbob

    I tried that.. but it did not do anything.. I have data that is populated into the list box and I want it to check and see if any data is in the listbox when the command button is pressed. if ther isn't id like a message to pop up... heres the code I have so far

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    01-09-2014
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: im trying to get a message to pop up when button is pressed and nothing is in listbob

    Can you upload the workbook?

  9. #9
    Forum Contributor
    Join Date
    01-27-2015
    Location
    New hampshire
    MS-Off Ver
    excel 2013
    Posts
    143

    Re: im trying to get a message to pop up when button is pressed and nothing is in listbob

    here it is
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    01-09-2014
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: im trying to get a message to pop up when button is pressed and nothing is in listbob

    I am stuck at "File not found" as you have defined a function to get data from a txt file located at your desktop. It will be good if you can upload that as well.

  11. #11
    Forum Contributor
    Join Date
    01-27-2015
    Location
    New hampshire
    MS-Off Ver
    excel 2013
    Posts
    143

    Re: im trying to get a message to pop up when button is pressed and nothing is in listbob

    sorry heres one of the files. if you type in 127195 in the text box and click get data this file should show up in list box.
    Attached Files Attached Files

  12. #12
    Forum Contributor
    Join Date
    01-27-2015
    Location
    New hampshire
    MS-Off Ver
    excel 2013
    Posts
    143

    Re: im trying to get a message to pop up when button is pressed and nothing is in listbob

    that is in a folder want me to upload the folder?

  13. #13
    Registered User
    Join Date
    01-09-2014
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: im trying to get a message to pop up when button is pressed and nothing is in listbob

    no this will do. Thanks.

  14. #14
    Forum Contributor
    Join Date
    01-27-2015
    Location
    New hampshire
    MS-Off Ver
    excel 2013
    Posts
    143

    Re: im trying to get a message to pop up when button is pressed and nothing is in listbob

    okay... so if you notice when you first open and you type that number in you can click save data and it will save it without it even coming up in the list box.. so that's why I want a message that says get data first so it will show up in the listbox

  15. #15
    Registered User
    Join Date
    01-09-2014
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: im trying to get a message to pop up when button is pressed and nothing is in listbob

    I guess this is what you wanted. Check it and let me know if it is working as per your requirements.
    Attached Files Attached Files

  16. #16
    Registered User
    Join Date
    01-09-2014
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: im trying to get a message to pop up when button is pressed and nothing is in listbob

    I guess i have mistakenly deleted the headings in the worksheet. Apologies for that.

  17. #17
    Forum Contributor
    Join Date
    01-27-2015
    Location
    New hampshire
    MS-Off Ver
    excel 2013
    Posts
    143

    Re: im trying to get a message to pop up when button is pressed and nothing is in listbob

    almost!! this is seeing if the textbox is empty.. im worried about the listbox... if the listbox is empty I want the message to come up thank you

  18. #18
    Registered User
    Join Date
    01-09-2014
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: im trying to get a message to pop up when button is pressed and nothing is in listbob

    Working on it

  19. #19
    Forum Contributor
    Join Date
    01-27-2015
    Location
    New hampshire
    MS-Off Ver
    excel 2013
    Posts
    143

    Re: im trying to get a message to pop up when button is pressed and nothing is in listbob

    thank you! your a big help

  20. #20
    Registered User
    Join Date
    01-09-2014
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: im trying to get a message to pop up when button is pressed and nothing is in listbob

    Hello mate, I have made some changes and now it should work. Check it and let me know. I have added message box which will appear if part number is not entered.
    Attached Files Attached Files
    Last edited by MDembla; 03-01-2015 at 02:27 AM.

+ 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. Toggle Button on Workbook Open - value is True but button not pressed?
    By excelnat in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 07-03-2014, 11:23 AM
  2. [SOLVED] Toggle the name of a button when pressed
    By JimDandy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-04-2013, 03:29 PM
  3. If cell is empty and macro is pressed display error message.
    By karol2234 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-20-2012, 01:47 PM
  4. [SOLVED] Toggle Button & getting the postion of the just pressed button
    By NugentS in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-12-2012, 11:58 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