murraythek
Board Regular
- Joined
- Aug 31, 2015
- Messages
- 61
Macro worked perfectly under Windows 7. Now under Windows 10 it returns an error of 2 ?? inside squares like this: (sorry they dont copy over exactly as shown)
Sub Button11_Click()
Dim clipboard As New MSForms.DataObject
Dim Cmt1 As String
Dim Cmt2 As String
Dim Cmt3 As String
Dim Cmt4 As String
Dim Cmt5 As String
Dim Cmt6 As String
Dim Cmt7 As String
Dim Cmt8 As String
Dim Cal1 As String
Dim Cal2 As String
Dim Cal3 As String
Dim Amt1 As String
Dim Amt2 As String
Dim BKL As String
If Worksheets("lookups").Range("E2").Value = 2 Then
BKL = vbCrLf
Else
BKL = ""
End If
If Worksheets("Income_Calculator").Range("C6").Value = 0 Then
If Worksheets("Income_Calculator").Range("C5").Value = 0 Then
MsgBox "Please input the Pay Period End Date of main applicant in the cell C5."
Worksheets("Income_Calculator").Range("C5").Select
Exit Sub
Else
End If
Else
End If
If Worksheets("Income_Calculator").Range("C23").Value = 0 Then
MsgBox "Please input main applicant's claimed monthly income amount in the cell C23."
Worksheets("Income_Calculator").Range("C23").Select
Exit Sub
Else
End If
Set clipboard = New MSForms.DataObject
Select Case Worksheets("lookups").Range("C1").Value
Case 1
Cal1 = "x52/12="
Cal3 = "x52/12="
Amt1 = VBA.Format(Worksheets("Income_Calculator").Range("C10").Value * Worksheets("Income_Calculator").Range("C11").Value, "$#,##0.00;($#,##0.00)")
Cmt1 = "GMI " & Amt1 & Cal1 & VBA.Format(Worksheets("Income_Calculator").Range("C23").Value, "$#,##0.00;($#,##0.00)") & ", "
Case 2
Cal1 = "x52/12="
Cal3 = "x52/12="
Amt1 = VBA.Format(Worksheets("Income_Calculator").Range("C12"), "$#,##0.00;($#,##0.00)")
Cmt1 = "GMI " & Amt1 & Cal1 & VBA.Format(Worksheets("Income_Calculator").Range("C23").Value, "$#,##0.00;($#,##0.00)") & ", "
Case 3
Cal1 = "x26/12="
Cal3 = "x26/12="
Amt1 = VBA.Format(Worksheets("Income_Calculator").Range("C12"), "$#,##0.00;($#,##0.00)")
Cmt1 = "GMI " & Amt1 & Cal1 & VBA.Format(Worksheets("Income_Calculator").Range("C23").Value, "$#,##0.00;($#,##0.00)") & ", "
Case 4
Cal1 = "x2="
Cal3 = "x2="
Amt1 = VBA.Format(Worksheets("Income_Calculator").Range("C12"), "$#,##0.00;($#,##0.00)")
Cmt1 = "GMI " & Amt1 & Cal1 & VBA.Format(Worksheets("Income_Calculator").Range("C23").Value, "$#,##0.00;($#,##0.00)") & ", "
Case 5
Cal1 = ""
Cal3 = "="
Amt1 = ""
Cmt1 = "GMI " & Amt1 & Cal1 & VBA.Format(Worksheets("Income_Calculator").Range("C23").Value, "$#,##0.00;($#,##0.00)") & ", "
End Select
If Worksheets("Income_Calculator").Range("C8") = 0 Then
Cal2 = VBA.Format(Worksheets("Income_Calculator").Range("C19").Value, "$#,##0.00;($#,##0.00)") & "/" & _
(Worksheets("lookups").Range("C2").Value - Worksheets("lookups").Range("C3").Value + 1) & "x52/12="
Else
Cal2 = VBA.Format(Worksheets("Income_Calculator").Range("C19").Value, "$#,##0.00;($#,##0.00)") & "/" & _
Worksheets("Income_Calculator").Range("C8").Value & Cal3
End If
If Worksheets("Income_Calculator").Range("C6").Value <> "" Then
Cmt7 = "(" & Worksheets("Income_Calculator").Range("C6").Value
If Worksheets("Income_Calculator").Range("C7").Value <> "" Then
Cmt7 = Cmt7 & ", " & Worksheets("Income_Calculator").Range("C7").Value & ")"
Else
Cmt7 = Cmt7 & ")"
End If
Else
If Worksheets("Income_Calculator").Range("C7").Value <> "" Then
Cmt7 = "(" & Worksheets("Income_Calculator").Range("C7").Value & ")"
Else
Cmt7 = ""
End If
End If
If Worksheets("Income_Calculator").Range("C5").Value > 0 Then
Cmt1 = "APP " & Cmt7 & " FINAL CALCS: " & BKL & "PPE " & VBA.Format(Worksheets("Income_Calculator").Range("C22").Value, "MM/DD/YYYY") & ", " & BKL & Cmt1
Else
Cmt1 = "APP " & Cmt7 & " FINAL CALCS: " & BKL & Cmt1
End If
If Worksheets("Income_Calculator").Range("C13").Value = 0 Then
Cmt2 = "YTD N/A, "
Else
Cmt2 = "YTD " & Cal2 & VBA.Format(Worksheets("Income_Calculator").Range("C24").Value, "$#,##0.00;($#,##0.00)") & ", "
End If
If Worksheets("Income_Calculator").Range("C25").Value = 0 Then
Cmt3 = ""
Else
If Worksheets("lookups").Range("E3").Value = 1 Then
Cmt3 = "Using (GMI) " & VBA.Format(Worksheets("Income_Calculator").Range("C23").Value, "$#,##0.00;($#,##0.00)") & " is " & Worksheets("Income_Calculator").Range("C26").Value & " than stated " & VBA.Format(Worksheets("Income_Calculator").Range("C25").Value, "$#,##0.00;($#,##0.00)")
Else
Cmt3 = "Using (YTD) " & VBA.Format(Worksheets("Income_Calculator").Range("C24").Value, "$#,##0.00;($#,##0.00)") & " is " & Worksheets("Income_Calculator").Range("C27").Value & " than stated " & VBA.Format(Worksheets("Income_Calculator").Range("C25").Value, "$#,##0.00;($#,##0.00)")
End If
End If
If Worksheets("Income_Calculator").Range("C32").Value > 0 And Worksheets("Income_Calculator").Range("C23").Value > 0 Then
If Worksheets("Income_Calculator").Range("C32").Value / Worksheets("Income_Calculator").Range("C23").Value >= 0.42 + (Worksheets("lookups").Range("E2") - 1) * 0.06 Then
Cmt5 = " and " '" above threshold "
Else
Cmt5 = " and " '" below threshold "
End If
Else
Cmt5 = ""
End If
If Worksheets("Income_Calculator").Range("C32").Value = 0 Then
Cmt4 = ""
Else
Cmt4 = " " & Worksheets("Income_Calculator").Range("C33").Value
End If
If Worksheets("lookups").Range("P1").Value = True Then
Cmt6 = "Taxed"
Else
Cmt6 = "Not Taxed"
End If
If Worksheets("lookups").Range("P2").Value = True Then
Cmt6 = Cmt6 & " " & "No Garn"
Else
End If
Cmt8 = Worksheets("Income_Calculator").Range("C35").Value & " "
clipboard.SetText Cmt1 & BKL & Cmt2 & BKL & Cmt3 & Cmt4 & Cmt5 & Cmt8 & BKL & Cmt6
clipboard.PutInClipboard
End Sub