[英]excel VBA - searching single column for a range of values and selecting the rows the values are in
Example: 例:
Column A has numerical values or strings in each cell, values of 0 - 15000 are listed, i need to find and select each row containing numerical values and add a border to the top of the row. 列A在每个单元格中都有数值或字符串,列出的值是0-15000,我需要查找并选择包含数值的每一行,并在该行的顶部添加边框。
Putting a border on top of each cell in the row was easy, but trying to search the column for numerical values has me stumped. 在行中每个单元格的顶部放置边框很容易,但是尝试在列中搜索数值很麻烦。
any help would be great. 任何帮助都会很棒。
Give this a try: 试试看:
Sub topHeavy()
Dim N As Long, i As Long
N = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To N
If IsNumeric(Cells(i, 1).Value) And Cells(i, 1).Value <> "" Then
With Cells(i, 1).EntireRow.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
End If
Next i
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.