msgbox NOT MsgBox

Maurizio

Well-known Member
Joined
Oct 15, 2002
Messages
682
Office Version
  1. 2007
Platform
  1. Windows
Why when I type "MsgBox" in VBA Editor of a my file I get always "msgbox" lower and NOT "MsgBox" as usual???
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Please post an example of a line of code where you are trying to use MsgBox.
 

Maurizio

Well-known Member
Joined
Oct 15, 2002
Messages
682
Office Version
  1. 2007
Platform
  1. Windows
Sub A_ImmagazzinaDatiInDB()

Dim ErroreMov
Dim ErroreDati As Integer
Dim ErroreVal As String, ErroreDocum As String, ErroreDB As String, ErroreIDArt As String
Dim tb As Worksheet
Dim i As Byte, NumReg As Byte
Dim NumRigDB As Long

'On Error Resume Next 'VERIFICARE
Application.ScreenUpdating = False

Sheets("Registrazione").Select
ErroreMov = Worksheets("Registrazione").Range("C7")
ErroreDati = Application.WorksheetFunction.CountA(Worksheets("Registrazione").Range("C9:E108"))
NumReg = Worksheets("Registrazione").Range("H2")
ErroreVal = Worksheets("Registrazione").Range("I2")
ErroreDocum = Worksheets("Registrazione").Range("I3")
ErroreDB = Worksheets("Registrazione").Range("I4")
ErroreIDArt = Worksheets("Registrazione").Range("I5")

If ErroreMov = "" Then msgbox "Attenzione: inserire N° di movimento", vbCritical, "Errore: N° Mov Assente": Exit Sub
If ErroreDati = 0 Then msgbox "Attenzione: dati assenti", vbCritical, "Errore: Dati Assenti": Exit Sub
If ErroreDati Mod 3 <> 0 Then msgbox "Attenzione: dati incompleti", vbCritical, "Errore: Dati Incompleti": Exit Sub
If ErroreVal = "Errori in Registrazione" Then msgbox "Attenzione: presenza di valori errati in Registrazione", vbCritical, "Errore: Valori errati": Exit Sub
If ErroreDocum = "Errori in Docum" Then msgbox "Attenzione: presenza di valori errati in Docum", vbCritical, "Errore: Valori errati": Exit Sub
If ErroreDB = "Dati DB incongrui" Then msgbox "Attenzione: valori in DB cancellati o superflui", vbCritical, "Errore: Valori DB incongrui": Exit Sub
If ErroreIDArt = "Dati IDArticoli incongrui" Then msgbox "Attenzione: valori in IDArticoli cancellati o incompleti", vbCritical, "Errore: Valori IDArticoli incongrui": Exit Sub

Sheets("DB").Unprotect
If Worksheets("DB").FilterMode = True Then
Worksheets("DB").ShowAllData
End If

Sheets("Registrazione").Select
Sheets("Registrazione").Unprotect

' Codice nascondi righe
Set tb = Sheets("Registrazione")
For i = 8 To 108
If IsEmpty(tb.Cells(i, 3)) Then tb.Rows(i).EntireRow.Hidden = True
Next i

' Immagazzina gli ART di "Registrazione" in DB
Range("I9:U108").Select
Selection.SpecialCells(xlCellTypeVisible).Copy

Sheets("DB").Select
Cells(65536, 1).End(xlUp).Offset(1, 0).Select

Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.CutCopyMode = False

' Converte/Ripulisce celle-testo in numero
Range("A1").Select
Cells.Replace What:="", Replacement:="!&/", LookAt:=xlWhole, _
SearchOrder:=xlByRows, MatchCase:=False
Cells.Replace What:="!&/", Replacement:="", LookAt:=xlWhole, _
SearchOrder:=xlByRows, MatchCase:=False
Cells.Replace What:=" ", Replacement:=" ", LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False
Cells.Find(What:="", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False).Activate

' Ripristina tutte le righe dopo stampa
tb.Rows("8:108").EntireRow.Hidden = False
tb.Activate

' Pulisce i vecchi dati Registrazione
Range("C7,C9:F108").ClearContents
Application.CutCopyMode = False

' AggiornaPrezzoMatrice
NumRigDB = Application.WorksheetFunction.CountA(Worksheets("DB").Range("A:A"))
Range("E5").FormulaArray = "=IF(R[-3]C[3]>0,MAX(IF(DB!R[-3]C[1]:R" & NumRigDB & "C[1]=R[-2]C[3],IF(DB!R[-3]C[4]:R" & NumRigDB & "C[4]>0,DB!R[-3]C[7]:R" & NumRigDB & "C[7]/DB!R[-3]C[4]:R" & NumRigDB & "C[4]))),"""")"
Range("E6").FormulaArray = "=IF(R[-4]C[3]>0,MIN(IF(DB!R[-4]C[1]:R" & NumRigDB & "C[1]=R[-3]C[3],IF(DB!R[-4]C[4]:R" & NumRigDB & "C[4]>0,DB!R[-4]C[7]:R" & NumRigDB & "C[7]/DB!R[-4]C[4]:R" & NumRigDB & "C[4]))),"""")"

Application.Goto Reference:=Worksheets("Registrazione").Range("C7"), Scroll:=True
Worksheets("Registrazione").Protect

Sheets("DB").Select
Range("A1").Select
Selection.Sort Key1:=Range("A1"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

Application.Goto Reference:=Worksheets("DB").Cells(65536, 1).End(xlUp).Offset(-NumReg + 1, 0), Scroll:=True
Cells(65536, 1).End(xlUp).Offset(1, 0).Select
Sheets("DB").Protect

End Sub
 

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
I can't reproduce the problem, but maybe Excel is interpreting the colons in your message box text as multiple statement indicators.

Try replacing the colons with a dash (-) or splitting the code like this:

If ErroreMov = "" Then
Msgbox "Attenzione: inserire N° di movimento", vbCritical, "Errore: N° Mov Assente"
Exit Sub
End If
 

Maurizio

Well-known Member
Joined
Oct 15, 2002
Messages
682
Office Version
  1. 2007
Platform
  1. Windows
It's very strange or/and unic! The Sub runs correctly but in this particulary file I don't get anyway "MsgBox"!!!
 

Forum statistics

Threads
1,144,437
Messages
5,724,356
Members
422,546
Latest member
KevinOnTheDaily

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
Top