如果满足条件,请选择一个单元格

时间:2019-05-14 15:18:39

标签: excel vba

如果条件满足,我正在尝试编写代码以选择单元格。尝试运行我的代码后,结果是我的代码正常工作,但是没有选择相应的行

您能帮我推断一下我的代码有什么问题吗?

谢谢

Sub AnalysisNote()

'1. Copy the client's name and its note ranked by 4 particular conditions (20;17-20;15-17;11-15;<11)

Dim finalrow As Long, i As Long
Dim clientnote As Range 'find
Const startrowb As Byte = 6
Dim c As Byte

c = 9
finalrow = Cells(Rows.Count, 1).End(xlUp).Row
Set clientnote = ShNote.Rows(startrowb).Find _
(What:=ShNote.Cells(startrowb, c).Value, LookIn:=xlValues, MatchCase:=False, lookat:=xlWhole)


For i = startrowb To finalrow
    If clientnote.Value = 20 Then
        Range(Cells(i, c)).Select
    End If
Next i

End Sub

我希望我的宏在“ I”列上找到值20,然后选择它。

p.s:我在第一列上有几个值“ 20”

0 个答案:

没有答案