ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Msg boxes in VBA (https://www.excelbanter.com/excel-programming/309655-msg-boxes-vba.html)

Celtic_Avenger[_17_]

Msg boxes in VBA
 
Tis me again!

I want to make a message box show the details of two cells.

For example:

Your minimum sales today must be £4500

The 4500 comes from a cell value, which will change from week to week.

How do I change the Msgbox code to do this?

Thanks
Celtic_Avenger
:confused: :confused: :confused: :confused: :confused

--
Message posted from http://www.ExcelForum.com


cucchiaino

Msg boxes in VBA
 
"Celtic_Avenger " ha scritto
nel messaggio ...

I want to make a message box show the details of two cells.



MsgBox (Range("A1") & Chr(13) & Range("A2"))



Celtic_Avenger[_24_]

Msg boxes in VBA
 
Thanks for your help cucchiaino,

I have amended that code to the following..........

MsgBox (Range("AC6") & Range("AD6") & Range("AE6"))

to take into account the cells I needed to use......however how do I
now change the Title of the Msgbox?

I want the title to show "Expected Sales" and not "Microsoft Excel".

Thanks

Celtic_Avenger
:confused: :confused: :confused: :confused: :confused:


---
Message posted from http://www.ExcelForum.com/


Tom Ogilvy

Msg boxes in VBA
 
as shown in Help

msgbox Prompt:=Range("AC6") & Range("AD6") & Range("AE6"), _
Title:="Exptected Sales

Note that you don't encase the arguments in parentheses unless you are
getting a return value such as

res = msgbox(Prompt:=Range("AC6") & Range("AD6") & Range("AE6"), _
Title:="Exptected Sales)

--
Regards,
Tom Ogilvy



"Celtic_Avenger " wrote in
message ...
Thanks for your help cucchiaino,

I have amended that code to the following..........

MsgBox (Range("AC6") & Range("AD6") & Range("AE6"))

to take into account the cells I needed to use......however how do I
now change the Title of the Msgbox?

I want the title to show "Expected Sales" and not "Microsoft Excel".

Thanks

Celtic_Avenger
:confused: :confused: :confused: :confused: :confused:


---
Message posted from http://www.ExcelForum.com/




Celtic_Avenger[_25_]

Msg boxes in VBA
 
Thanks Tom and cucchiaino for all your help.


Celtic_Avenger
:) :) :) :) :

--
Message posted from http://www.ExcelForum.com


LDSXena

Msg boxes in VBA
 
This post is extremely helpful to me except that I need to pull the data from
a different sheet. I've played with a couple syntaxes but I'm not getting
the right one. Could someone tell me how to specify which sheet to draw the
data from?

Thanks all!
LDSXena

"Tom Ogilvy" wrote:

as shown in Help

msgbox Prompt:=Range("AC6") & Range("AD6") & Range("AE6"), _
Title:="Exptected Sales

Note that you don't encase the arguments in parentheses unless you are
getting a return value such as

res = msgbox(Prompt:=Range("AC6") & Range("AD6") & Range("AE6"), _
Title:="Exptected Sales)

--
Regards,
Tom Ogilvy



"Celtic_Avenger " wrote in
message ...
Thanks for your help cucchiaino,

I have amended that code to the following..........

MsgBox (Range("AC6") & Range("AD6") & Range("AE6"))

to take into account the cells I needed to use......however how do I
now change the Title of the Msgbox?

I want the title to show "Expected Sales" and not "Microsoft Excel".

Thanks

Celtic_Avenger
:confused: :confused: :confused: :confused: :confused:


---
Message posted from http://www.ExcelForum.com/





Bob Phillips[_6_]

Msg boxes in VBA
 
Something like

With Worksheets("Sheet")
msgbox Prompt:=.Range("AC6") & .Range("AD6") & .Range("AE6"), _
Title:="Exptected Sales
End With

--

HTH

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


"LDSXena" wrote in message
...
This post is extremely helpful to me except that I need to pull the data

from
a different sheet. I've played with a couple syntaxes but I'm not getting
the right one. Could someone tell me how to specify which sheet to draw

the
data from?

Thanks all!
LDSXena

"Tom Ogilvy" wrote:

as shown in Help

msgbox Prompt:=Range("AC6") & Range("AD6") & Range("AE6"), _
Title:="Exptected Sales

Note that you don't encase the arguments in parentheses unless you are
getting a return value such as

res = msgbox(Prompt:=Range("AC6") & Range("AD6") & Range("AE6"), _
Title:="Exptected Sales)

--
Regards,
Tom Ogilvy



"Celtic_Avenger " wrote

in
message ...
Thanks for your help cucchiaino,

I have amended that code to the following..........

MsgBox (Range("AC6") & Range("AD6") & Range("AE6"))

to take into account the cells I needed to use......however how do I
now change the Title of the Msgbox?

I want the title to show "Expected Sales" and not "Microsoft Excel".

Thanks

Celtic_Avenger
:confused: :confused: :confused: :confused: :confused:


---
Message posted from http://www.ExcelForum.com/







LDSXena

Msg boxes in VBA
 
Taking what you said, here is how I adapted the code to my program. When the
compiler gets it though it says "Compiler error: Expected end of statement"
then highlights "Msgbox." My programming is C++ and Java based so some sort
of grammatical mark makes sense to me after I declare which sheet to work on.
Obviously I'm not familiar with VB so can anyone debug this for me?

Sub show_Question01()
'
' show_Question1 Macro
' This macro shows the user the text to Question 1 in the chart.
'
With Worksheets("Data w Charts")
Msgbox Prompt:=.Range("B1") _
Title:="Question Text"
End With

End Sub

Thanks all!
Sabrina

"Bob Phillips" wrote:

Something like

With Worksheets("Sheet")
msgbox Prompt:=.Range("AC6") & .Range("AD6") & .Range("AE6"), _
Title:="Exptected Sales
End With

--

HTH

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


"LDSXena" wrote in message
...
This post is extremely helpful to me except that I need to pull the data

from
a different sheet. I've played with a couple syntaxes but I'm not getting
the right one. Could someone tell me how to specify which sheet to draw

the
data from?

Thanks all!
LDSXena

"Tom Ogilvy" wrote:

as shown in Help

msgbox Prompt:=Range("AC6") & Range("AD6") & Range("AE6"), _
Title:="Exptected Sales

Note that you don't encase the arguments in parentheses unless you are
getting a return value such as

res = msgbox(Prompt:=Range("AC6") & Range("AD6") & Range("AE6"), _
Title:="Exptected Sales)

--
Regards,
Tom Ogilvy



"Celtic_Avenger " wrote

in
message ...
Thanks for your help cucchiaino,

I have amended that code to the following..........

MsgBox (Range("AC6") & Range("AD6") & Range("AE6"))

to take into account the cells I needed to use......however how do I
now change the Title of the Msgbox?

I want the title to show "Expected Sales" and not "Microsoft Excel".

Thanks

Celtic_Avenger
:confused: :confused: :confused: :confused: :confused:


---
Message posted from http://www.ExcelForum.com/








Bob Phillips[_6_]

Msg boxes in VBA
 
You removed the comma after the message contents

Sub show_Question01()
'
' show_Question1 Macro
' This macro shows the user the text to Question 1 in the chart.
'
With Worksheets("Data w Charts")
MsgBox Prompt:=.Range("B1"), _
Title:="Question Text"
End With

End Sub




--

HTH

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


"LDSXena" wrote in message
...
Taking what you said, here is how I adapted the code to my program. When

the
compiler gets it though it says "Compiler error: Expected end of

statement"
then highlights "Msgbox." My programming is C++ and Java based so some

sort
of grammatical mark makes sense to me after I declare which sheet to work

on.
Obviously I'm not familiar with VB so can anyone debug this for me?

Sub show_Question01()
'
' show_Question1 Macro
' This macro shows the user the text to Question 1 in the chart.
'
With Worksheets("Data w Charts")
Msgbox Prompt:=.Range("B1") _
Title:="Question Text"
End With

End Sub

Thanks all!
Sabrina

"Bob Phillips" wrote:

Something like

With Worksheets("Sheet")
msgbox Prompt:=.Range("AC6") & .Range("AD6") & .Range("AE6"), _
Title:="Exptected Sales
End With

--

HTH

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


"LDSXena" wrote in message
...
This post is extremely helpful to me except that I need to pull the

data
from
a different sheet. I've played with a couple syntaxes but I'm not

getting
the right one. Could someone tell me how to specify which sheet to

draw
the
data from?

Thanks all!
LDSXena

"Tom Ogilvy" wrote:

as shown in Help

msgbox Prompt:=Range("AC6") & Range("AD6") & Range("AE6"), _
Title:="Exptected Sales

Note that you don't encase the arguments in parentheses unless you

are
getting a return value such as

res = msgbox(Prompt:=Range("AC6") & Range("AD6") & Range("AE6"), _
Title:="Exptected Sales)

--
Regards,
Tom Ogilvy



"Celtic_Avenger "

wrote
in
message ...
Thanks for your help cucchiaino,

I have amended that code to the following..........

MsgBox (Range("AC6") & Range("AD6") & Range("AE6"))

to take into account the cells I needed to use......however how do

I
now change the Title of the Msgbox?

I want the title to show "Expected Sales" and not "Microsoft

Excel".

Thanks

Celtic_Avenger
:confused: :confused: :confused: :confused: :confused:


---
Message posted from http://www.ExcelForum.com/










LDSXena

Msg boxes in VBA
 
Thanks for your quick replies!

I know I'm being a pain now but I copied and pasted the code into my macro
and it's still giving me the same error. The compiler wants something before
MsgBox. I'm completely in the dark as to what it wants.

Sabrina

"Bob Phillips" wrote:

You removed the comma after the message contents

Sub show_Question01()
'
' show_Question1 Macro
' This macro shows the user the text to Question 1 in the chart.
'
With Worksheets("Data w Charts")
MsgBox Prompt:=.Range("B1"), _
Title:="Question Text"
End With

End Sub



Bob Phillips[_6_]

Msg boxes in VBA
 
I just tried it again, and it worked fine form me.

--

HTH

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


"LDSXena" wrote in message
...
Thanks for your quick replies!

I know I'm being a pain now but I copied and pasted the code into my macro
and it's still giving me the same error. The compiler wants something

before
MsgBox. I'm completely in the dark as to what it wants.

Sabrina

"Bob Phillips" wrote:

You removed the comma after the message contents

Sub show_Question01()
'
' show_Question1 Macro
' This macro shows the user the text to Question 1 in the chart.
'
With Worksheets("Data w Charts")
MsgBox Prompt:=.Range("B1"), _
Title:="Question Text"
End With

End Sub





LDSXena

Msg boxes in VBA
 
Hmmmm . . . I just don't know why it won't work for me.

Just to clarify incase I haven't explained the situation well and that's why
the code works for you and not me . . . I have a chart on a stand-alone
sheet. I have another sheet called "Data w Charts" that contains the data.
Because the questions get long, I don't want the question texts as the
labels. I took out the labels all together and put text boxes instead with
the question number. Right now I have macros taking the user to the actual
spreadsheet and cell with the question text. I already know my boss won't
like that so I'm trying to get a box or some sort of message to pop up with
question text. Idealy, I would like some sort of mouseover box that appears
over hot spots and disappears when the user moves the mouse off but I have no
clue where to begin for that sort of thing.

Oh great mind what can you conceive for my pitiful self? !o)

Thanks
Sabrina


"Bob Phillips" wrote:

I just tried it again, and it worked fine form me.

--

HTH

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


"LDSXena" wrote in message
...
Thanks for your quick replies!

I know I'm being a pain now but I copied and pasted the code into my macro
and it's still giving me the same error. The compiler wants something

before
MsgBox. I'm completely in the dark as to what it wants.

Sabrina

"Bob Phillips" wrote:

You removed the comma after the message contents

Sub show_Question01()
'
' show_Question1 Macro
' This macro shows the user the text to Question 1 in the chart.
'
With Worksheets("Data w Charts")
MsgBox Prompt:=.Range("B1"), _
Title:="Question Text"
End With

End Sub



Bob Phillips[_6_]

Msg boxes in VBA
 
So, are you saying that the question is in a textbox and you want to get
that? If so, where does Range("B12) come into it?

BTW If you send me the workbook, I can add some mouseover code.

--

HTH

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


"LDSXena" wrote in message
...
Hmmmm . . . I just don't know why it won't work for me.

Just to clarify incase I haven't explained the situation well and that's

why
the code works for you and not me . . . I have a chart on a stand-alone
sheet. I have another sheet called "Data w Charts" that contains the

data.
Because the questions get long, I don't want the question texts as the
labels. I took out the labels all together and put text boxes instead

with
the question number. Right now I have macros taking the user to the

actual
spreadsheet and cell with the question text. I already know my boss won't
like that so I'm trying to get a box or some sort of message to pop up

with
question text. Idealy, I would like some sort of mouseover box that

appears
over hot spots and disappears when the user moves the mouse off but I have

no
clue where to begin for that sort of thing.

Oh great mind what can you conceive for my pitiful self? !o)

Thanks
Sabrina


"Bob Phillips" wrote:

I just tried it again, and it worked fine form me.

--

HTH

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


"LDSXena" wrote in message
...
Thanks for your quick replies!

I know I'm being a pain now but I copied and pasted the code into my

macro
and it's still giving me the same error. The compiler wants something

before
MsgBox. I'm completely in the dark as to what it wants.

Sabrina

"Bob Phillips" wrote:

You removed the comma after the message contents

Sub show_Question01()
'
' show_Question1 Macro
' This macro shows the user the text to Question 1 in the chart.
'
With Worksheets("Data w Charts")
MsgBox Prompt:=.Range("B1"), _
Title:="Question Text"
End With

End Sub





LDSXena

Msg boxes in VBA
 
I would love to get some mouseover code!

What email addy do I send the workbook to?

Sabrina

Bob Phillips[_6_]

Msg boxes in VBA
 
bob dot phillips at tiscali dot co dot uk

do the obvious with that

--

HTH

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


"LDSXena" wrote in message
...
I would love to get some mouseover code!

What email addy do I send the workbook to?

Sabrina





All times are GMT +1. The time now is 06:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com