+ Reply to Thread
Results 1 to 14 of 14

Display results in message box

Hybrid View

  1. #1
    Registered User
    Join Date
    11-21-2009
    Location
    Rhyl, North Wales
    MS-Off Ver
    Excel 2003
    Posts
    39

    Display results in message box

    Hi there, any help would be appreciated. I have wrote a macro to summarise some tabled data, the data consists of machine name (eg: machine1-8), machine number (this is a unique identifer) and amount which is a cash value. This all works fine but i would like to display the Summarised results in a msgbox but am unsure how to go about it as the number of machines is a variable (as in on one occation there maybe 10 machines other times there might be 30 machines). The summarised data begins at row 7 across columns AI,AJ and AK. Thanks in advance

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Display results in message box

    Hi

    I think you need to upload your workbook and mock up an example of exactly what you want to see in your message box and relate it to the summarised data.

    But why are you wanting to display some results in a transitory message box? Why not write them to the workbook? In fact why do you need a macro to summarise data at all when there are perfectly good standard excel functions to do this? They are far more efficient and quicker than any VBA code you choose to write.

    Regards
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    11-21-2009
    Location
    Rhyl, North Wales
    MS-Off Ver
    Excel 2003
    Posts
    39

    Re: Display results in message box

    Thanks for your response. I've attached a Jpeg of the sheet i'm working on. the user would enter data on the left hand side (pale blue boxes, Columns B-C & E-J), my code then copies the info skiping blanks to Columns AE-AG then Summarises it in AI-AK. Its from here i would like to display these summarised results in a messagebox but as you can see on this occasion there would be 8 machines displayed, next time the might be 20 machines displayed and i'm unsure how to handle this. Yes i realise this would be alot easier just to display the result on the workbook but i'd like to try something abit new. Any help would be appreciated, thanks

    What i'd like to see in the message box:


    Machine1 1 £5
    Machine2 2 £10
    Machine3 3 £2
    Machine4 4 £2

    Total = £......

    etc... incuding all machines in the summarised list
    Attached Images Attached Images
    Last edited by Swift4Play; 08-31-2010 at 06:17 AM.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Display results in message box

    You probably need Photoshop, if it's an excel problem then excel would be best
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  5. #5
    Registered User
    Join Date
    11-21-2009
    Location
    Rhyl, North Wales
    MS-Off Ver
    Excel 2003
    Posts
    39

    Re: Display results in message box

    I'm sorry but i dont understand your reply, whats photoshop got to do with me displaying the data found in Range(AI6:AK14) of the image i posted in a message box using vba ?

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Display results in message box

    How's an image goint to help us with your Excel workbook, you were asked to attach a workbook

  7. #7
    Registered User
    Join Date
    11-21-2009
    Location
    Rhyl, North Wales
    MS-Off Ver
    Excel 2003
    Posts
    39

    Re: Display results in message box

    Sorry i attached the image rather than the workbook as i thought seeing where the summarised data was stored would be enough, i apologise. i have decided to go with plan b and simply replace the data with the summarised data on the worksheet, shame as i stated i was keen to learn something new, thank you for time anyways.
    Attached Files Attached Files

  8. #8
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Display results in message box

    I can't see why you need a macro, use SUMIF

  9. #9
    Registered User
    Join Date
    11-21-2009
    Location
    Rhyl, North Wales
    MS-Off Ver
    Excel 2003
    Posts
    39

    Re: Display results in message box

    Summarising the data isn't an issue, i have wrote some code which works a treat, the only part i was stuck on was trying to get the summarised results displayed in a messagebox so i could have a button which when clicked would display the summarised results without re-arranging the data on the sheet. so something like


    Machine1 = Range("AI7").Value
    CoNo1 = Range("AJ7.Value
    Amout1 = Range("AK7.Value

    Machine2= Range(AI8").Value
    CoNo2 = Range("AJ8").Value
    Amount2 = Range("AK8").value

    (For however many machines in summarised data)

    msgbox " & Machine1 & CoNo1 & Amount1 & VbCrLf & Machine2 & CoNo2 & Amount2 & "

    i hope you get the idea, if this is possible it would be prefered.

  10. #10
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Display results in message box

    If you want to display the table with the summaries in then I would suggest a listbox in a UserForm. Using a messagebox would involve more coding.

    As to the summarising, I wondered why you felt the need for VBA to do it

    Here's an example
    Attached Files Attached Files
    Last edited by royUK; 08-31-2010 at 08:44 AM.

  11. #11
    Registered User
    Join Date
    11-21-2009
    Location
    Rhyl, North Wales
    MS-Off Ver
    Excel 2003
    Posts
    39

    Re: Display results in message box

    ah briliant, i had previous thought of displaying the data on a userform but was unsure about the process, would you be able to guide me through using a listbox to display my information ?

  12. #12
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Display results in message box

    Sorry missed your reply, I've added an example to my previous post

  13. #13
    Registered User
    Join Date
    11-21-2009
    Location
    Rhyl, North Wales
    MS-Off Ver
    Excel 2003
    Posts
    39

    Re: Display results in message box

    Thank you so much, this is spot on what i'm after, thank you for your patience, you the man

  14. #14
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Display results in message box

    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

+ 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.6.0 RC 1