问题
I'm trying to do a Select Case
with Left
function (contain(text in the cell)
would be better but I don't know how to do that) but wasn't able to figure out how to do that.
I tried the following:
Sub siteadd()
Dim x
Dim Pl
Dim Li
Sheets("ort").Select
Columns("F:F").Select
Selection.TextToColumns Destination:=Range("F1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
:=Array(1, 2), TrailingMinusNumbers:=True
NumRows = cells(Rows.Count, "j").End(xlUp).Row
For x = 2 To NumRows
Li = cells(x, 6).Value
Pl = cells(x, 40).FormulaR1C1 = "=Left(RC[40], 12)"
Select Case Li
Case "#N/A"
Select Case Pl
Case "asc aite Aad"
cells(x, 6).Value = "B"
End Select
End Select
Next x
End Sub
来源:https://stackoverflow.com/questions/36574574/how-to-do-a-select-case-with-left-function-in-vba