Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Ayden Smith   on Feb 20 In MS Office Category.

  
Question Answered By: Zane Thompson   on Feb 20

see if this helps:

Sub FindNumericPartOfAcctNumber()

StringToEvaluate = ActiveCell.Value


StringToEvaluate=LTrim(StringToEvaluate)

StringToEvaluate=RTrim(StringToEvaluate)

StrLength = Len(StringToEvaluate)
LeftNumeric = 0

For ct = 1 To StrLength
vCharacter = Mid(StringToEvaluate, ct, 1)
Select Case vCharacter
Case 0 To 9
LeftNumeric = LeftNumeric + 1
Case Else
ct = StrLength
End Select
Next ct
NumericPartOfAcctNumber = Left(StringToEvaluate, LeftNumeric)

End Sub

Share: 

 

This Question has 20 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on trouble with IF/OR, Left and a simple loop Or get search suggestion and latest updates.


Tagged: