+ Reply to Thread
Results 1 to 6 of 6

Thread: Dependant Text in a MsgBox

  1. #1
    Registered User
    Join Date
    11-08-2011
    Location
    Washington
    MS-Off Ver
    Excel 2003
    Posts
    23

    Dependant Text in a MsgBox

    How do I make the message that appears at the conclusion of a macro display a value that is sourced from another list. For example, you can use a drop down list to select your location. The Macro copies the value to several places around the workbook and then pops up a message that says "You changed your location". I would love it to say "You changed your location to 'VALUE'" where as "value" would be the location you selected.

    Any way to do this? I imagine it is something along the lines of:

    MsgBox "You changed your location to 'A1'"
    Or something like that....

  2. #2
    Forum Guru davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2007
    Posts
    1,879

    Re: Dependant Text in a MsgBox

    msgbox "You changed your location to '" & combobox1.Value & "'",vbokonly
    Is your code running too slowly?
    Does your workbook or database have a bunch of duplicate pieces of data?
    Have a look at this article to learn the best ways to set up your projects.
    It will save both time and effort in the long run!


    Dave

  3. #3
    Registered User
    Join Date
    11-08-2011
    Location
    Washington
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: Dependant Text in a MsgBox

    Thanks for the quick reply! Ummm....apparently I'm not as smart as I though...How do I modify the code you so generously shared to make it work. The cell that contains the value I want displayed is "J1".

    So would that make it look like this?:

    msgbox "You changed your location to '" & combobox1.J1 & "'",vbokonly

  4. #4
    Forum Guru davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2007
    Posts
    1,879

    Re: Dependant Text in a MsgBox

    msgbox "You changed your location to '" & cells(1,"J").value & "'",vbokonly
    Is your code running too slowly?
    Does your workbook or database have a bunch of duplicate pieces of data?
    Have a look at this article to learn the best ways to set up your projects.
    It will save both time and effort in the long run!


    Dave

  5. #5
    Registered User
    Join Date
    11-08-2011
    Location
    Washington
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: Dependant Text in a MsgBox

    Genius, thank you sir!

  6. #6
    Forum Guru, retired Admin royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    25,640

    Re: Dependant Text in a MsgBox

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save
    Hope that helps.

    RoyUK
    --------
    If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need

    For Excel Tips & Solutions, free examples and tutorials why not check out my downloads

    New members please read & follow the Forum Rules

    Remember to mark your questions Solved and rate the answer(s)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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.2.0