This only happens when I run this code. The result displays all filtered rows on sheet CARDS2024 that match the value "clothes" in the Memo column 4 that contains
multiple lines of descriptive text. Even after I added Application Enable Events and Application Screen Updating to False at the beginning of the code and rese to True at the end of the code it still gives the message "The picture is too large and wijll be truncated". CoPilot suggested this is a Clear clipboard issue, which I did and it still shows the message. This does no happen with any other code block in this large application - only this one given below. So, it must be someting in the code. Rebooting to recover more memory does not fix it either. I'm at a loss. If using arrays in the code would help I'll do that but have no idea where to insert the array(s) as I have not used arrlays before.
The code works great except for this quirk. Any insights to solve this surely would be appreciated Thanks for anyone's help.
cr
v
multiple lines of descriptive text. Even after I added Application Enable Events and Application Screen Updating to False at the beginning of the code and rese to True at the end of the code it still gives the message "The picture is too large and wijll be truncated". CoPilot suggested this is a Clear clipboard issue, which I did and it still shows the message. This does no happen with any other code block in this large application - only this one given below. So, it must be someting in the code. Rebooting to recover more memory does not fix it either. I'm at a loss. If using arrays in the code would help I'll do that but have no idea where to insert the array(s) as I have not used arrlays before.
Code:
Private Sub cmdFILTERAUTO_Click()
Dim lastrow As Long, wc, wr As Worksheet
Set wc = ThisWorkbook.Sheets("CARDS2024")
Set wr = ThisWorkbook.Sheets("REPORT")
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.Calculation = xlCalculationManual
wr.Cells.Clear
lastrow = wc.Cells(wc.Rows.count, 5).End(xlUp).row
wc.Range("A2").AutoFilter
wc.Range("$E$1:$EI$" & lastrow).AutoFilter Field:=4, Criteria1:="=*clothes*", Operator:=xlAnd
wc.AutoFilter.Range.SpecialCells(xlVisible).copy Destination:=wr.Range("A1")
Application.CutCopyMode = False
wc.AutoFilterMode = False
With wr
If .Range("A1") <> "" Then
If WorksheetFunction.CountA(.Range("E:E")) = 1 Then
.Range("E1:E1").Name = "ResultTotal"
.Range("ResultTotal").Offset(2, 0).Formula = "=SUM(ResultTotal)"
.Range("ResultTotal").Offset(2, 0).Name = "SumResultTotal"
.Range("SumResultTotal").NumberFormat = "$#,##0.00"
Else
.Range("E1:E" & .Range("E1").End(xlDown).row).Name = "ResultTotal"
.Range("ResultTotal").End(xlDown).Offset(2, 0).Formula = "=SUM(ResultTotal)"
.Range("ResultTotal").End(xlDown).Offset(2, 0).Name = "SumResultTotal"
.Range("SumResultTotal").NumberFormat = "$#,##0.00"
End If
UpdateTotalInTextBox2 wr
End If
End With
Application.Calculation = xlCalculationAutomatic
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
Private Sub UpdateTotalInTextBox2(wr As Worksheet)
Dim total As Variant
total = wr.Range("SumResultTotal").value
If IsNumeric(total) Then
UserForm1.TextBox2.value = Format(total, "Currency")
Else
UserForm1.TextBox2.value = "N/A"
End If
UserForm1.Show
End Sub
cr
v
Attachments
Last edited: