如果单元格值为 0 并插入关系公式,则遍历单元格 L 和字体红色
Go through cell L and font red if cell value is 0 and insert relational formula
所以除 vlookup 部分外,一切正常。 vlookup 的查找值不随单元格行移动。我不确定如何让 "F&cell.number" 与行一起移动。
Sub fontredd()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim rngL As range
Dim cell As range
Set rngL = range("L1", range("L65536").End(xlUp))
For Each cell In rngL
If cell.Value = "0" Then
cell.EntireRow.Font.Color = vbRed
cell.Formula = "=VLOOKUP(F&cell.number,[PickupCompaniesCommissions.xls]Sheet1!$U:$V,2,FALSE)"
End If
Next cell
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
cell.Formula = "=VLOOKUP(F" & cell.Row & ", [PickupCompaniesCommissions.xls]Sheet1!$U:$V,2,FALSE)"
所以除 vlookup 部分外,一切正常。 vlookup 的查找值不随单元格行移动。我不确定如何让 "F&cell.number" 与行一起移动。
Sub fontredd()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim rngL As range
Dim cell As range
Set rngL = range("L1", range("L65536").End(xlUp))
For Each cell In rngL
If cell.Value = "0" Then
cell.EntireRow.Font.Color = vbRed
cell.Formula = "=VLOOKUP(F&cell.number,[PickupCompaniesCommissions.xls]Sheet1!$U:$V,2,FALSE)"
End If
Next cell
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
cell.Formula = "=VLOOKUP(F" & cell.Row & ", [PickupCompaniesCommissions.xls]Sheet1!$U:$V,2,FALSE)"