|
楼主 |
发表于 2010-8-24 14:11
|
显示全部楼层
现在是解读公式的问题
我的目的是自己能掌握,能修改。
Private Sub CommandButton1_Click()
Range("C5:C65536") = ""
For i = 5 To Range("A65536").End(xlUp).Row
n = 1
m = Left(Range("A" & i), 4)
我想取成品前6位,把这个“4”改成“6”,怎么后面的中间两位码失去流水码的功能
For p = 5 To Range("C65536").End(xlUp).Row
If Left(Range("C" & p), 4) = m And Left(Range("B" & p), 1) = 1 Then
n = n + 1
End If
Next
Dim two
Dim three
If Right(Range("B" & i), 1) = 4 Then
Range("C" & i) = "原料"
Else
Select Case Right(Range("B" & i), 1)
Case 1
two = 0
three = 0
Case 2
two = two + 1
three = 0
n = n - 1
Case 3
three = three + 1
n = n - 1
End Select
Range("C" & i) = m & "-" & WorksheetFunction.Text(n, "00") & "-" & WorksheetFunction.Text(two, "00") & WorksheetFunction.Text(three, "00")
End If
Next
End Sub
[ 本帖最后由 handsomcao 于 2010-8-24 14:35 编辑 ] |
|