需要插入VDB(i,35)=时删除整行内部颜色变色指数22(珊瑚)的语句。根据列值更改整行的内部颜色VBA
我需要在这个块内执行这一步,而不需要在新块中添加代码(除非绝对必要),因为工作表有20K个条目。我假设,因为这是我确定物品何时处于“已删除”状态的位置,并且将“已删除”放在第35列中,我应该能够在同一步骤/区块中对其进行着色,并且这将是最有效的方法。我可能是错误的..
是否有另一行我可以在最后一行后添加,这将彩色索引35中的这些条目=“已删除”吗?
我曾尝试将vDB(i,35)作为范围传递给另一个变量,并对其进行设置,然后使用if =删除以更改entirerow.interior.color index = 22,但无法获取措辞正确,并可能采取错误的做法。我仍然处于学习的曲线中,但在仔细研究小组之前,试图弄清楚我自己的问题,但我似乎无法做到。
这里是剪切它。
'Execute Find (Vlookup)
For i = 1 To UBound(vDB, 1)
'If sht.Cells(i, 1).Value <> "" Then
If vDB(i, 1) <> "" Then
Set rng = rngData.Find(vDB(i, 1), LookIn:=xlValues, Lookat:=xlWhole) 'Matches entire contents of cell for an exact match
If Not rng Is Nothing Then
'If found return value of column 9 of ABC Recalc Cycle Count Remainder Browse (offset by 2), into ABC Matrix monthly ABC Code column, as determined by variable
vDB(i, ABCCodeCell) = rng.Offset(, 7)
'If found, return the value of column 7 of ABC Recalc Cycle Count Remainder Browse (offset by 2), into ABC Matrix column 27
vDB(i, 27) = rng.Offset(, 5)
'If found, return the value of column 11 of ABC Recalc Cycle Count Remainder Browse (offset by 2), into ABC Matrix column 34
vDB(i, 33) = rng.Offset(, 9)
'If found, place value of ABCMatrixMonthSelect.ComboBox1 in column AO Col Index 41
vDB(i, 41) = ABCMatrixMonthSelect.ComboBox1.value
Else
vDB(i, 35) = "Deleted"
vDB(i, 41) = ABCMatrixMonthSelect.ComboBox1.value
With vDB(i, 1) = sht.Cells.Interior.Color = RGB(247, 119, 109) 'Light Red
End With
End If
End If
If vDB(i, ABCCodeCell) = vDB(i, lastMonthABCCode) Then
vDB(i, 36) = "No"
Else
vDB(i, 36) = "Yes"
End If
DoEvents
Next
rngDB = vDB
Dim LR As Long
LR = sht.Cells(Rows.Count, 1).End(xlUp).Row
sht.Cells.FormatConditions.Delete
With sht.Range("1:" & LR)
.FormatConditions.Add Type:=xlExpression, Formula1:="=$AI1=""Deleted""" 'Searches for value "Deleted" in Range 1 to last row
With .FormatConditions(.FormatConditions.Count)
.SetFirstPriority
With .Interior
.Color = RGB(247, 119, 109) 'Light Red
End With
End With
End With
'Reset Excel Status Bar
Application.StatusBar = False
e here
您是否尝试过使用条件格式? – Cyril
我需要这个VBA来获得报告。不是我需要设置的东西,或者依赖于用户来设置的,除非您通过VBA说我可以设置条件格式,对着色行进行着色......这可能会有所不同。这是一个巨大的宏,从各种报告中获取价值,并逐月编译。在35中的“已删除”值的行将突出显示,直到处理报告的下个月,然后我将它们清除,重新运行以识别新的“删除:”的步骤。但是我可以轻松地擦除它们价值35(因为这是隐藏的我自己的意图),如果这是更好的 – SharePoint0508
我打开任何最有意义的方式,是最好的办法,并且运作最快,因为这是一个如此大的工作表。 – SharePoint0508