Patrick O'Dea
asked on
VBA Excel Statement NM = MsgBox("Data has been clear", vbOKOnly, "New Month")
See
NM = MsgBox("Data has been clear", vbOKOnly, "New Month")
What does this mean? I understand the bit to the right of the "=".
What does the bit to the left mean?
The NM (presumably "New Month") is never referred to again else where.
What purpose does it serve (since never referred to again)
Sub NewMonth()
Application.ScreenUpdating = False
Sheet48.Select
Range("GoTo1").Select
Range(Selection, Selection.End(xlDown)).Sel ect
Selection.Copy
Range(Selection, Selection.End(xlToLeft)).S elect
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Range("A1").Select
Sheet38.Select
Range("EvaDailyData").Sele ct
Selection.ClearContents
Range("A1").Select
Sheet29.Select
Application.ScreenUpdating = True
NM = MsgBox("Data has been clear", vbOKOnly, "New Month")
End Sub
NM = MsgBox("Data has been clear", vbOKOnly, "New Month")
What does this mean? I understand the bit to the right of the "=".
What does the bit to the left mean?
The NM (presumably "New Month") is never referred to again else where.
What purpose does it serve (since never referred to again)
Sub NewMonth()
Application.ScreenUpdating
Sheet48.Select
Range("GoTo1").Select
Range(Selection, Selection.End(xlDown)).Sel
Selection.Copy
Range(Selection, Selection.End(xlToLeft)).S
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Range("A1").Select
Sheet38.Select
Range("EvaDailyData").Sele
Selection.ClearContents
Range("A1").Select
Sheet29.Select
Application.ScreenUpdating
NM = MsgBox("Data has been clear", vbOKOnly, "New Month")
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Since you have already accepted an answer to this question I obviously don't expect any points but I feel I should make a couple of comments.
1) While as Steve pointed out MsgBox("Data has been clear", vbOKOnly, "New Month") will give you an error, MsgBox "Data has been clear", vbOKOnly, "New Month" won't. That's because the former is calling the MsgBox function expecting a return value, while the latter doesn't.
2) When you want to know what the user's response is you can do something like this.
1) While as Steve pointed out MsgBox("Data has been clear", vbOKOnly, "New Month") will give you an error, MsgBox "Data has been clear", vbOKOnly, "New Month" won't. That's because the former is calling the MsgBox function expecting a return value, while the latter doesn't.
2) When you want to know what the user's response is you can do something like this.
NM = MsgBox("Do you want to clear the data?", vbYesNo, "New Month")
If NM = vbNo Then
Exit Sub
Else
' Clear the data
End If
ASKER
Thank ML .... Some day that will be useful!
ASKER