0

How do I select a specific character from a string in VBA? The strings first characters always differ but the last 6 does not.

Say the string is: A = 1/2’’ NPT

Here I would like to get the ‘ closest to 2.

If the string is: A = 1-1/2’’ NPT

I would still want the ‘ closest to 2.

Any help would be appreciated! - Remi

1
  • You say the last six characters don't differ. So you're always going to want to select ? Commented Jan 10, 2018 at 8:34

1 Answer 1

1
Sub test()

    Dim myStr As String

    myStr = "A = 1/2"" NPT"

    myStr = Split(myStr, """")(0)
    myStr = Split(myStr, "= ")(1)

    MsgBox myStr

End Sub
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.