我正在处理电子表格,并且需要生成一个批号。该批号由W / O编号+ 110120编号的最后三位数组成
W / O编号位于单元格Q7中,110120编号位于单元格B7中
所以我知道我需要将这两个数字连接在一起。然而,110120号码是9位数,我只想要最后三位,所以我认为我需要将110120号码分成6位数字然后3位数,然后连接W / O号码和最后3位数字。你同意吗?
我提出了以下代码:
Private Function FSABT100LotNumber(value1 As Integer) As Integer
Dim strValue1 As String
Dim strValue1WONo, strValue1110120 As String
Dim value1WONo, value1110120 As Integer
'converts the values into strings for the Left() and Right() functions
strValue1 = CStr(value1)
Select Case Len(value1) 'gives a number depending on the length of the value1
Case 9 ' e.g., 902900123 = 902900, 123
strValue1WONo = Left(value1, 6) ' 902900
strValue1110120 = Right(value1, 3) ' 123
End Select
value1WONo = CInt(strValue1WONo)
value1110120 = CInt(strValue1110120)
Range("F29").Select
ActiveCell.Value = value1WONo & value110120
End Function
然而,我知道有些事情是不对的。我需要告诉函数W / O编号在单元格Q7中,110120编号在单元格B7中。问题是我不确定我在哪里这样做。
感谢您帮助我!