I wrote code that calculates if-then conditional values and then appears in a message box. How do I export the the message box to MS Word? Is there a function that instead of Msgbox, I could export to MS Word? Could I convert it to word from Debug.print?
Sub Way_EatFresh()
Dim ws As Worksheet, wsB As Worksheet
Set ws = Worksheets("Overview")
Set wsB = Worksheets("Billing Rates")
Dim trueCount As Integer
Dim i As Integer
Dim Cst, Hrs
For i = 1 To 11
If ws.Range(Chr(65 + i) & "36").Value = "True" Then
trueCount = trueCount + 1
Cst = Cst + wsB.Range(Chr(66 + i) & "33").Value
Hrs = Hrs + wsB.Range(Chr(66 + i) & "25").Value
Scope = Scope + wsB.Range(Chr(66 + i) & "150").Value
End If
If ws.Range(Chr(65 + i) & "37").Value = "True" Then
trueCount = trueCount + 1
Cst = Cst + wsB.Range(Chr(66 + i) & "34").Value
Hrs = Hrs + wsB.Range(Chr(66 + i) & "26").Value
Scope = Scope + wsB.Range(Chr(66 + i) & "150").Value
End If
If ws.Range(Chr(65 + i) & "38").Value = "True" Then
trueCount = trueCount + 1
Cst = Cst + wsB.Range(Chr(66 + i) & "35").Value
Hrs = Hrs + wsB.Range(Chr(66 + i) & "27").Value
Scope = Scope + wsB.Range(Chr(66 + i) & "150").Value
End If
If ws.Range(Chr(65 + i) & "40").Value = "True" Then
trueCount = trueCount + 1
Cst = Cst + wsB.Range(Chr(66 + i) & "49").Value
Hrs = Hrs + wsB.Range(Chr(66 + i) & "41").Value
Scope = Scope + wsB.Range(Chr(66 + i) & "150").Value
End If
If ws.Range(Chr(65 + i) & "41").Value = "True" Then
trueCount = trueCount + 1
Cst = Cst + wsB.Range(Chr(66 + i) & "50").Value
Hrs = Hrs + wsB.Range(Chr(66 + i) & "42").Value
Scope = Scope + wsB.Range(Chr(66 + i) & "150").Value
End If
If ws.Range(Chr(65 + i) & "42").Value = "True" Then
trueCount = trueCount + 1
Cst = Cst + wsB.Range(Chr(66 + i) & "51").Value
Hrs = Hrs + wsB.Range(Chr(66 + i) & "43").Value
Scope = Scope + wsB.Range(Chr(66 + i) & "150").Value
End If
Next i
If trueCount > 0 Then
MsgBox "Cost: " & Cst _
& vbNewLine & "Hours: " & Hrs _
& vbNewLine & "Scope: " & Scope _
End If
If trueCount = 0 Then
MsgBox "Please select engagement components."
End If
End Sub