Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Msg Box Qquestion

I want the message box window to appear with the
the following lines.

The total profit is = Range.value(A1)

The total loss is= Range.value(B1)

Is it possible to combine both messages
in single statement.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default Msg Box Qquestion

John

Sub CombinedMessage()
MsgBox _
"The total profit is = " & Range("A1").Value & _
Chr(10) & _
"The total loss is = " & Range("B1").Value, , _
"Combined Profit and Loss"
End Sub

Regards

Trevor


"John" wrote in message
...
I want the message box window to appear with the
the following lines.

The total profit is = Range.value(A1)

The total loss is= Range.value(B1)

Is it possible to combine both messages
in single statement.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default Msg Box Qquestion

John, try this

MsgBox "The total profit is " & [A1] _
& vbCrLf & "The total profit is " & [B1]

--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 97 & 2000
** remove news from my email address to reply by email **

"John" wrote in message
...
I want the message box window to appear with the
the following lines.

The total profit is = Range.value(A1)

The total loss is= Range.value(B1)

Is it possible to combine both messages
in single statement.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Msg Box Qquestion

Hi John,

Something like this should work for you:

MsgBox prompt:="The total profit is: " & _
Format$(Range("A1").Value, "$#,##0.00") & _
vbLf & vbLf & "The total loss is: " & _
Format$(Range("B1").Value, "$#,##0.00"), _
Buttons:=vbInformation, Title:="Profit/Loss"

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


John wrote:
I want the message box window to appear with the
the following lines.

The total profit is = Range.value(A1)

The total loss is= Range.value(B1)

Is it possible to combine both messages
in single statement.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default Msg Box Qquestion

should be
MsgBox "The total profit is " & [A1] _
& vbCrLf & "The total loss is" & [B1]

"Paul B" wrote in message
...
John, try this

MsgBox "The total profit is " & [A1] _
& vbCrLf & "The total profit is " & [B1]

--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 97 & 2000
** remove news from my email address to reply by email **

"John" wrote in message
...
I want the message box window to appear with the
the following lines.

The total profit is = Range.value(A1)

The total loss is= Range.value(B1)

Is it possible to combine both messages
in single statement.








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 140
Default Msg Box Qquestion

John wrote:

I want the message box window to appear with the
the following lines.

The total profit is = Range.value(A1)

The total loss is= Range.value(B1)

Is it possible to combine both messages
in single statement.


MsgBox "The total profit = " & Range("A1").Value & vbCrLf & _
"The total loss = " & Range("B1").Value

The "_" is to tell the compiler(?) the sentence continues on the next line.

Regards,
--
Beto
Reply: Erase between the dot (inclusive) and the @.
Responder: Borra la frase obvia y el punto previo.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 690
Default Msg Box Qquestion

If your cells are already formatted as currency, you could use the .text
property to return that same format.

Sub Demo()
Dim s As String
s = "Total Profit: " & _
[A1].Text & _
vbLf & vbLf & _
"Total Loss: " & _
[B1].Text

MsgBox s, vbInformation, "Profit / Loss"
End Sub


--
Dana DeLouis
Using Windows XP & Office XP
= = = = = = = = = = = = = = = = =


"John" wrote in message
...
I want the message box window to appear with the
the following lines.

The total profit is = Range.value(A1)

The total loss is= Range.value(B1)

Is it possible to combine both messages
in single statement.




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 07:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"