ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Msgbox syntax error (https://www.excelbanter.com/excel-programming/422968-msgbox-syntax-error.html)

JMay

Msgbox syntax error
 
In my activesheet I have the value Memphis

In my code I'm try to get the Msgbox to say:

Memphis has not reported in today<<
but the following is turning red in my code window;
can someone assist?

MsgBox "Range("D1").value & " has not reported in today"

FSt1

Msgbox syntax error
 
hi,
one double quote too many. try this
MsgBox Range("D1").value & " has not reported in today"

another way.....
Dim r As Range
Set r = Range("D1")
MsgBox r.Value & " has not reported in today"

regards
FSt1
"JMay" wrote:

In my activesheet I have the value Memphis

In my code I'm try to get the Msgbox to say:

Memphis has not reported in today<<
but the following is turning red in my code window;
can someone assist?

MsgBox "Range("D1").value & " has not reported in today"


Dave Peterson

Msgbox syntax error
 
MsgBox activesheet.Range("D1").value & " has not reported in today"

I'd qualify the range with the sheet and/or the workbook/sheet.

And just in case:

MsgBox activesheet.Range("D1").value _
& " has not reported in today: " _
& format(date,"mmmm dd, yyyy")

JMay wrote:

In my activesheet I have the value Memphis

In my code I'm try to get the Msgbox to say:

Memphis has not reported in today<<
but the following is turning red in my code window;
can someone assist?

MsgBox "Range("D1").value & " has not reported in today"


--

Dave Peterson

JMay

Msgbox syntax error
 
Thanks Guys

"Dave Peterson" wrote:

MsgBox activesheet.Range("D1").value & " has not reported in today"

I'd qualify the range with the sheet and/or the workbook/sheet.

And just in case:

MsgBox activesheet.Range("D1").value _
& " has not reported in today: " _
& format(date,"mmmm dd, yyyy")

JMay wrote:

In my activesheet I have the value Memphis

In my code I'm try to get the Msgbox to say:

Memphis has not reported in today<<
but the following is turning red in my code window;
can someone assist?

MsgBox "Range("D1").value & " has not reported in today"


--

Dave Peterson



All times are GMT +1. The time now is 05:15 PM.

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