VBA代码自动填充列基于来自不同列的值

时间:2018-03-21 20:07:01

标签: excel-vba vba excel

在E栏中,我有数字和NA。对于E列中的所有NA,我必须使用“create / map”自动填充D列。有人可以帮我修复我的代码吗?谢谢。

Sub Rules1()
'
'Autofill based on Rules
'

'
    Worksheets("ORD_CS").Activate
Dim sht As Worksheet
Dim LR As Long
Dim i As Long

Set sht = ActiveWorkbook.Worksheets("ORD_CS")
LR = sht.UsedRange.Rows.Count

    With sht
        For i = 8 To LR
            If Range("H" & i).Value = "NA" Then
                Range("D" & i).Value = "Create/Map"
            End If
        Next i
    End With

End Sub

0 个答案:

没有答案