为什么这个IF公式不起作用?

时间:2018-05-29 19:03:24

标签: excel-vba if-statement vba excel

有人可以帮助我以下..它似乎找到一切没有问题,但它不会打印报告。细胞(i,1)= hr.Cells(j,3)部分。有一次,它确实以某种方式将其打印出来,但它只是覆盖了第一个单元格。

Dim hr As Worksheet
Dim report As Worksheet
Sub populateMetaData()
Dim i As Integer, j As Integer
Set report = ActiveWorkbook.Worksheets("Report")
Set hr = ActiveWorkbook.Worksheets("HR_Report")

For j = 2 To hr.UsedRange.Rows.Count
    For i = 2 To report.UsedRange.Rows.Count

        If hr.Cells(j, 10) = "AWM TECH & OPS" Then
            report.Cells(i, 1) = hr.Cells(j, 3)

        End If

    Next i
Next j


End Sub

0 个答案:

没有答案