您可以使用下面的VBA代码实现此功能:
Sub hide_columns_highlight_duplicates() Columns("A:C").EntireColumn.Hidden = True Columns("D:IV").Select Selection.FormatConditions.AddUniqueValues Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority With Selection.FormatConditions(1)