Macro not updated

Formula11

Active Member
Joined
Mar 1, 2005
Messages
468
Office Version
  1. 365
Platform
  1. Windows
I noticed that if code is changed slightly, when run in Excel the macro does not run as per updated code.
Example is for message box.
If text is changed, it won't update in Excel a lot of the time. Sometimes it does though.
Is there a setting somewhere to account for this?

VBA Code:
    MsgBox "– This sentence." _
    & vbNewLine & "– That sentence." _
    , 64 _
    , "About"
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
That code consistently produces the Message box below. There are no variables used so I would not expect anything else.
What is the actual issue ?


1672052449312.png
 
Upvote 0
Thanks for responding.
Maybe I didn't explain properly.

If for example "sentence" is changed to "sentence1", the message box still shows the former text, the output you have above.
 
Upvote 0
I just type it in the Visual Basic Editor.
Maybe it was a copy and paste.

The thing is that I never noticed this before, in using previous versions of Excel. Mentioning this in case it has something to do with it.
 
Upvote 0
I would expect something more like this and even more likely would be a cell on the right hand side of the equal sign.

VBA Code:
Sub test()

    Dim str1 As String, str2 As String
    
    str1 = "sentence no1"
    str2 = "sentence 2nd line"
    
    MsgBox "– " & str1 & "." _
    & vbNewLine & "– That " & str2 & "." _
    , 64 _
    , "About"
    
End Sub
 
Upvote 0
OK thanks but I was trying to find the reason for why it was happening.
I've coded in Visual Basic every now and again for many years, and never had the issue before.
 
Upvote 0
I'm afraid that don't follow what the issue is. I would need to see the code you are using, the output you are getting and the output you are expecting.
 
Upvote 0
OK thanks, it's as simple as stated above.
Change code in Visual Basic Editor, in this case text in a message box, run macro, output often seems to be for the previous code.
 
Upvote 0
I am sorry but I can't reproduce that result. The message box will faithfully reproduce the text entered on to the line.
The only way that wouldn't happen is if you had some other code with the same message box and you are not running the version of the message box you think you are running.
ie do you have the code in the Sheet module and the same code in multiple sheet modules ?
 
Upvote 0

Forum statistics

Threads
1,223,702
Messages
6,173,953
Members
452,539
Latest member
delvey

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top