ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   code that can distinguish between alpha and numeric characters (https://www.excelbanter.com/excel-programming/310166-code-can-distinguish-between-alpha-numeric-characters.html)

Boffita

code that can distinguish between alpha and numeric characters
 
Hi,

I just need some help, i wanted to know if i can use VBA code that ca
distinguish between alpha and numeric characters in a cell in excel

For example

We have 2 codes 02-DIS-001-BHIN
and 02-039-001-BHIN

and we need to able to go down a list of items as above and separat
these

Many thanks for your help,

Boffita
:

--
Message posted from http://www.ExcelForum.com


K Dales[_2_]

code that can distinguish between alpha and numeric characters
 
Not sure I understand you: are you saying that you need a way to distinguish
those cell values that have numeric characters in spaces 4,5,6 from those
with alpha in those spaces? If so it is not hard at all, and could be done
either in VBA or with a worksheet function:

VBA:
Function CellType(CellTxt as String) As String
If IsNumeric(Mid(CellTxt,4,3)) Then CellType = "Numeric" Else CellType="Char"
End Function

Excel:
=IF(ISERR(VALUE(MID(CellToCheck,4,3))),"ALPHA","NU MERIC")

"Boffita " wrote:

Hi,

I just need some help, i wanted to know if i can use VBA code that can
distinguish between alpha and numeric characters in a cell in excel

For example

We have 2 codes 02-DIS-001-BHIN
and 02-039-001-BHIN

and we need to able to go down a list of items as above and separate
these

Many thanks for your help,

Boffita
:)


---
Message posted from http://www.ExcelForum.com/




All times are GMT +1. The time now is 12:00 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com