ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Function not working quite as required (https://www.excelbanter.com/excel-programming/277033-re-function-not-working-quite-required.html)

Harald Staff[_5_]

Function not working quite as required
 
A brilliant approach, Tom. Why didn't I think of that ...<g

Best wishes Harald
Excel MVP
Followup to newsgroup only please

"Tom Ogilvy" skrev i melding
...
This appears to work as well:

Function ValCat(r As Range)
Dim sVal As String
ValCat = 4
sVal = r.Text
If sVal Like "[A-Z]" Then ValCat = 1
If sVal Like "[A-Z]#" Then ValCat = 3
If sVal Like "[A-Z]##" Then ValCat = 3
If sVal Like "#" Then ValCat = 2
If sVal Like "##" Then ValCat = 2
End Function

--
Regards,
Tom Ogilvy




Stuart[_5_]

Function not working quite as required
 
Many thanks all, for the suggestions.

Regards.

"Harald Staff" wrote in message
...
A brilliant approach, Tom. Why didn't I think of that ...<g

Best wishes Harald
Excel MVP
Followup to newsgroup only please

"Tom Ogilvy" skrev i melding
...
This appears to work as well:

Function ValCat(r As Range)
Dim sVal As String
ValCat = 4
sVal = r.Text
If sVal Like "[A-Z]" Then ValCat = 1
If sVal Like "[A-Z]#" Then ValCat = 3
If sVal Like "[A-Z]##" Then ValCat = 3
If sVal Like "#" Then ValCat = 2
If sVal Like "##" Then ValCat = 2
End Function

--
Regards,
Tom Ogilvy





---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.518 / Virus Database: 316 - Release Date: 11/09/2003




All times are GMT +1. The time now is 09:47 AM.

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