Copy macro error with recent update to Windows 10

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)
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Sorry about the late reply. Here is the macro:

Code:
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

It works fine in Office 365 but not in the standard Excel version in office 2016.
 
Last edited by a moderator:
Upvote 0
UPDATE - still not working. As stated above the VBA works fine under Windows 7 but users on Windows 10 cannot use the copy macro.
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,200
Members
453,022
Latest member
RobertV1609

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
Back
Top