Question : Excel vb display result of a varable in a msgbox

Hello Experts,

I trying to write a macro (see below) to calculate the percentage of completion. I am getting compile errors with the msgbox function request help with syntax. Thank for your help.

Sub InspectionCompletion()

Dim OpenDisc As Double
Dim PagesBOW As Double
Dim InspCom As Double
Dim TotalDisc As Double

OpenDisc = CDbl(InputBox("Enter how many open items are on the BOW:"))
PagesBOW = CDbl(InputBox("Enter number of BOW pages:"))
TotalDisc = (PagesBOW) * 8
InspCom = (((TotalDisc) - (OpenDisc) / (TotalDisp)) * 100)
MsgBox =((InspCom),vbDefaultButton1,"Percentage of Inspection Completion is:",,o)
End Sub

Answer : Excel vb display result of a varable in a msgbox

or using Format
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
Sub InspectionCompletion()

Dim OpenDisc As Double
Dim PagesBOW As Double
Dim InspCom As Double
Dim TotalDisc As Double

OpenDisc = CDbl(InputBox("Enter how many open items are on the BOW:"))
PagesBOW = CDbl(InputBox("Enter number of BOW pages:"))
TotalDisc = (PagesBOW) * 8
InspCom = (TotalDisc - OpenDisc) / TotalDisc
MsgBox "Percentage of Inspection Completion is: " & Format(InspCom, "percent")
End Sub
Random Solutions  
 
programming4us programming4us