|
老师,请问一个问题:在迭代的数据处理结构程序中,下面这段程序的bflag的用途是什么,我的感觉
If sNo = aProducts(i) Then bflag = True
If bflag Then Range(BOM_PRODUCT_CELL) = sNo这两端代码是否多余啦?
Private Sub Worksheet_Activate()
Dim arr(), i&, rng As Range, sNo$, nCount&, bflag As Boolean
If nItemCol = 0 Then Call ParseData(BOM_SOURCE_SHEET_NAME)
Application.ScreenUpdating = False
sNo = Range(BOM_PRODUCT_CELL).Text
Cells.ClearContents
Cells.Validation.Delete
nCount = UBound(aProducts)
ReDim arr(1 To nCount + 1, 1 To 1)
For i = 1 To nCount
arr(i + 1, 1) = aProducts(i)
If sNo = aProducts(i) Then bflag = True
Next
Set rng = Cells(1, 1).Offset(0, UBound(aData, 2) + 10).Resize(nCount + 1, 1)
rng = arr
Range(BOM_LABEL_CELL) = "񅧏"
With Range(BOM_PRODUCT_CELL).Validation
.Add xlValidateList, xlValidAlertStop, xlBetween, "=" & rng.Address
.IgnoreBlank = True
.InCellDropdown = True
.ShowInput = False
.ShowError = True
End With
Set rng = Nothing
Application.ScreenUpdating = True
If bflag Then Range(BOM_PRODUCT_CELL) = sNo
Range(BOM_PRODUCT_CELL).Select
Range("e1") = " ±àºÅΪ90BCP70927AR140RµÄÓкܶà×ÓÏ£¬£¬£¬"
End Sub |
|