我想编写这个程序,突出全行重视,其中有“N”在各自的排列N内的值突出显示所有行等于在细胞foobar的
我不是太熟悉编码VBA的格式,我不能让这个程序的功能
Sub highlight_new_pos()
Dim rng As Range, lCount As Long, LastRow As Long
Dim cell As Object
With ActiveSheet 'set this worksheet properly!
LastRow = .Cells(Rows.Count, 1).End(xlUp).Row
For Each cell In .Range("N2:N" & LastRow)
If cell = "N" Then
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Next cell
End With
End Sub
[条件格式](https://support.office.com/zh-cn/article/Use-a-formula-to-apply-conditional-formatting-fed60dfa-1d3f- 4e13-9ecb-f1951ff89d7f)与本地工作表公式(例如'= $ N1 =“N”')是更好的解决方案。 – Jeeped
可能ColumnN比ColumnA有更多的条目? – pnuts
@pnuts - tbh,我从不使用任何预先制定的规则。我更喜欢提供适用的公式。 – Jeeped