Theo dõi các thay đổi bên trong công thức trong Excel: Lỗi thời gian chạy 1004
Tôi không có nhiều kinh nghiệm về lập trình hoặc macro trong Excel và đang cố gắng tạo một macro theo dõi các thay đổi trong các ô được tạo bằng công thức khi dữ liệu cơ bản thay đổi. Cho đến nay, tôi đã nhận được mã lỗi sau trong mã của mình: "Lỗi thời gian chạy '1004': không tìm thấy ô nào."
Vui lòng xem đoạn mã của tôi bên dưới:
`Sub ApplyCF() ' ' ConditionalFormatFormulaChangesRed Macro ' ' For Each WS In ActiveWorkbook.Worksheets For Each cell In WS.Cells.SpecialCells(xlCellTypeFormulas, 23) cell.FormatConditions.Add Type:=xlCellValue, Operator:=xlNotEqual, _ Formula1:="=" & cell.Value cell.FormatConditions(cell.FormatConditions.Count).SetFirstPriority With cell.FormatConditions(1).Interior .Color = 5664488 .TintAndShade = 0 End With cell.FormatConditions(1).StopIfTrue = False Next cell Next WS End Sub`
Comments
Post a Comment