Sub dd() Dim arr1, arr2, i As Long arr1 = [A2].Resize([A2].End(xlDown).Row - 1, 1) arr2 = [F2].Resize([A2].End(xlDown).Row - 1, 1) For i = 1 To UBound(arr1) If Left(arr1(i, 1), 2) = "61" And arr2(i, 1) = "库存" Then arr1(i, 1) = "库存" Else arr1(i, 1) = "在制" End If Next [G2].Resize([A2].End(xlDown).Row - 1, 1) = arr1 End Sub追问
Sub G列赋值() Dim i% For i = 2 To [a65536].End(3).Row If Left(Cells(i, 1), 2) = "61" And Cells(i, 6) = "库存" Then Cells(i, 7) = "库存" Else Cells(i, 7) = "在制" Next End Sub本回答被网友采纳
第2个回答 2017-02-07
Sub test() Dim num As Integer 'Worksheets(1)需要根据实际情况修改 num = Worksheets(1).UsedRange.Rows.Count
For i = 2 To num If Left(Cells(i, 1).Value, 2) = "61" And Cells(i, 6).Value = "库存" Then Cells(i, 7).Value = "库存" Else Cells(i, 7).Value = "在制" End If Next