我正在运行一个宏,该宏根据下拉列表选择在该工作簿中创建一个新工作簿和一个选项卡。我遇到了条件格式问题。当我运行宏时,条件格式规则存在,但颜色输出更改。例如,我有一个条件格式,根据另一个值更改绿色数字,但运行宏后颜色更改为橙色。 Doe的任何人都知道为什么?
这是我正在运行的代码
Sub BusinessPlan_Create()
Dim cell As Range
Dim counter As Long
Dim Dashboard As Worksheet
Dim newWB As Workbook
Dim wb1 As Workbook
Set wb1 = ThisWorkbook
Set newWB = Workbooks.Add
Set Dashboard = wb1.Sheets("Facility View")
Application.DisplayAlerts = False
For Each cell In wb1.Worksheets("dd").Range("$B3:$B87")
If cell.Value = "" Then
counter = counter + 1
Application.StatusBar = "Processing file: " & counter & "/1042"
Else
counter = counter + 1
Application.StatusBar = "Processing file: " & counter & "/1042"
With Dashboard
.Range("$B$1").Value = cell.Value
With wb1
.Worksheets("Facility View").Copy After:=newWB.Worksheets(1)
ActiveSheet.Cells.Copy
ActiveSheet.Range("A1").PasteSpecial Paste:=xlPasteSpecialOperationAdd
ActiveSheet.Name = cell.Value
End With
Application.CutCopyMode = False
End With
End If
Next cell
newWB.Activate
Call SortWorkBook2
Application.DisplayAlerts = True
Range("C6:D6").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Columns("C:C").EntireColumn.AutoFit
Columns("D:D").EntireColumn.AutoFit
Range("C4").Select
Application.CutCopyMode = False
End Sub