我的密码怎么了?
我想从零件号码中提取油漆代码。零件编号在"H“列中,我想要"I”列中的油漆代码。例如:对于GP231-5003-XCBK,我希望XCBK出现在列"I“中。
以下是目前为止的代码:
Dim K As Long
Dim LR As Long
LR = Cells(Rows.Count, 8).End(xIUp).Row
For K=2 to LR
Cells(K,9).Value = Right(Cells(K,8).Value, Len(Cells(K,8))-InStr(1, Cells(K,8).Value, "-"))
Next K
End sub错误发生在LR = Cells(Rows.Count, 8).End(xIUp).Row
发布于 2021-12-29 19:38:59
根据评论意见:
,
xlup,而不是xIUp。这是一个小写的L。
With ThisWorkbook.Worksheets("Aluminum Futures")
Dim LR As Long
LR = .Cells(.Rows.Count, 8).End(xlUp).Row
Dim K As Long
For K = 2 To LR
Dim str() As String
str = Split(.Cells(K, 8), "-")
.Cells(K, 9).Value = str(UBound(str))
Next K
End Withhttps://stackoverflow.com/questions/70523489
复制相似问题