+ Reply to Thread
Results 1 to 11 of 11

Message Box "Value"

  1. #1
    Forum Contributor
    Join Date
    02-19-2004
    Location
    San Francisco Bay Area
    MS-Off Ver
    Microsoft 365 Aps for enterprise.
    Posts
    241

    Message Box "Value"

    Hi All,
    I have written a macro to do several calculations in several sheets. Now I want to put the answer in a message box. The answer is in a defined field. All I am trying to do is "the answer is" & "here I want to give address of the defined filed"
    How can I do that?
    Thanks for ur help.
    Syed

  2. #2
    Bob Phillips
    Guest

    Re: Message Box "Value"

    Do you mean

    MsgBox "The answer is in A1"

    or

    MsgBox "The answer is " & Range("A1").Value

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "saziz" <[email protected]> wrote in message
    news:[email protected]...
    >
    > Hi All,
    > I have written a macro to do several calculations in several sheets.
    > Now I want to put the answer in a message box. The answer is in a
    > defined field. All I am trying to do is "the answer is" & "here I want
    > to give address of the defined filed"
    > How can I do that?
    > Thanks for ur help.
    > Syed
    >
    >
    > --
    > saziz
    > ------------------------------------------------------------------------
    > saziz's Profile:

    http://www.excelforum.com/member.php...fo&userid=6350
    > View this thread: http://www.excelforum.com/showthread...hreadid=382585
    >




  3. #3
    Forum Contributor
    Join Date
    02-19-2004
    Location
    San Francisco Bay Area
    MS-Off Ver
    Microsoft 365 Aps for enterprise.
    Posts
    241
    Bob,
    I mean the second of ur two. MsgBox "The answer is " & Range("A1").Value
    I will try this.
    Thanks


    Quote Originally Posted by Bob Phillips
    Do you mean

    MsgBox "The answer is in A1"

    or

    MsgBox "The answer is " & Range("A1").Value

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "saziz" <[email protected]> wrote in message
    news:[email protected]...
    >
    > Hi All,
    > I have written a macro to do several calculations in several sheets.
    > Now I want to put the answer in a message box. The answer is in a
    > defined field. All I am trying to do is "the answer is" & "here I want
    > to give address of the defined filed"
    > How can I do that?
    > Thanks for ur help.
    > Syed
    >
    >
    > --
    > saziz
    > ------------------------------------------------------------------------
    > saziz's Profile:

    http://www.excelforum.com/member.php...fo&userid=6350
    > View this thread: http://www.excelforum.com/showthread...hreadid=382585
    >

  4. #4
    Forum Contributor
    Join Date
    02-19-2004
    Location
    San Francisco Bay Area
    MS-Off Ver
    Microsoft 365 Aps for enterprise.
    Posts
    241
    Hi Bob,
    I tried following:
    MsgBox "The Average is" & Sheet3!Range("p2").Value
    It says 'Object required'
    Syed




    Quote Originally Posted by Bob Phillips
    Do you mean

    MsgBox "The answer is in A1"

    or

    MsgBox "The answer is " & Range("A1").Value

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "saziz" <[email protected]> wrote in message
    news:[email protected]...
    >
    > Hi All,
    > I have written a macro to do several calculations in several sheets.
    > Now I want to put the answer in a message box. The answer is in a
    > defined field. All I am trying to do is "the answer is" & "here I want
    > to give address of the defined filed"
    > How can I do that?
    > Thanks for ur help.
    > Syed
    >
    >
    > --
    > saziz
    > ------------------------------------------------------------------------
    > saziz's Profile:

    http://www.excelforum.com/member.php...fo&userid=6350
    > View this thread: http://www.excelforum.com/showthread...hreadid=382585
    >

  5. #5
    Forum Contributor
    Join Date
    11-09-2004
    Posts
    451
    you extract the value from Sheet3 at p2 cell, it should sheets("Sheet3").Range("p2").Value


    try this

    MsgBox "The Average is" & sheets("Sheet3").Range("p2").Value

  6. #6
    Forum Contributor
    Join Date
    02-19-2004
    Location
    San Francisco Bay Area
    MS-Off Ver
    Microsoft 365 Aps for enterprise.
    Posts
    241
    Thank you Anil it is working. How can I restrict decimal places, it is giving me all 14 decimal places. Is there a format syntax?
    Thank you

  7. #7
    Forum Contributor
    Join Date
    11-09-2004
    Posts
    451
    Yes use
    format(sheets("Sheet3").Range("p2").Value,"#.##")
    this will give two decimal places

    MsgBox "The Average is" & format(sheets("Sheet3").Range("p2").Value,"#.##")

  8. #8
    Forum Contributor
    Join Date
    02-19-2004
    Location
    San Francisco Bay Area
    MS-Off Ver
    Microsoft 365 Aps for enterprise.
    Posts
    241
    Thanks once again Anil
    It works perfectly.

  9. #9
    Forum Contributor
    Join Date
    02-19-2004
    Location
    San Francisco Bay Area
    MS-Off Ver
    Microsoft 365 Aps for enterprise.
    Posts
    241
    Anil,
    Can you please show me how to increase the font size in message box? what would be the syntax?
    Thanks

  10. #10
    Forum Contributor
    Join Date
    11-09-2004
    Posts
    451

  11. #11
    Elizabeth
    Guest

    Re: Message Box "Value"

    Anil:
    Is there a way to format a number in a msgbox if it is: 1) preceded by
    text, & 2) calculated in the code, not drawn from a worksheet? I want to
    display a message similar to this example ("The sum is: ") with the number in
    123,456 format. I am able to format the number alone using the following
    code, but I can't figure out how to add "The sum is: " and retain the comma
    formatting.
    MsgBox prompt:=Format(expression:=totalvar, Format:="0,0")
    Thank you for any suggestions!
    Elizabeth

    "anilsolipuram" wrote:

    >
    > Yes use
    > format(sheets("Sheet3").Range("p2").Value,"#.##")
    > this will give two decimal places
    >
    > MsgBox "The Average is" &
    > format(sheets("Sheet3").Range("p2").Value,"#.##")
    >
    >
    > --
    > anilsolipuram
    > ------------------------------------------------------------------------
    > anilsolipuram's Profile: http://www.excelforum.com/member.php...o&userid=16271
    > View this thread: http://www.excelforum.com/showthread...hreadid=382585
    >
    >


+ 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