我从这个站点获得了以下代码,它选择了 H 列中包含值“1”的所有单元格,它工作得很好,但我希望你能帮助我选择 H 列中包含负值的所有单元格
Sub H()
Dim TheSheet As Worksheet
If TypeOf ActiveSheet Is Worksheet Then
Set TheSheet = ActiveSheet
Else
Exit Sub
End If
Dim Row As Integer
Dim CellsToSelect As String
For Row = 1 To TheSheet.Range("H" & CStr(TheSheet.Rows.Count)).End(xlUp).Row
If TheSheet.Range("H" & CStr(Row)).Value = 1 Then
If CellsToSelect <> "" Then CellsToSelect = CellsToSelect & ","
CellsToSelect = CellsToSelect & "H" & CStr(Row)
End If
Next Row
TheSheet.Range(CellsToSelect).Select
End Sub
感谢如果提前诺埃尔