PC Review


Reply
Thread Tools Rate Thread

Determine data type in a string

 
 
news.epix.net
Guest
Posts: n/a
 
      31st Oct 2007
Could someone please tell me how to determine the data type of each char of
a string?

I have worksheets named 'October07'. I need to extract just the month name
first and then
the year number.

I would like to loop thru the string until I find an integer character.

Thanks,
M. Miller


 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      31st Oct 2007
=LEFT(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"0123456789"))-1)

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"news.epix.net" <(E-Mail Removed)> wrote in message
news:006BDD4E-20AD-4C95-92C7-(E-Mail Removed)...
> Could someone please tell me how to determine the data type of each char
> of a string?
>
> I have worksheets named 'October07'. I need to extract just the month
> name first and then
> the year number.
>
> I would like to loop thru the string until I find an integer character.
>
> Thanks,
> M. Miller
>
>



 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      31st Oct 2007
You can use isnumeric.

dim lCtr as long
dim myWord as string
dim myStr as string
myWord = "October07"
myStr = ""
for lctr = 1 to len(myword)
if isnumeric(mid(myword, lctr, 1)) then
'get out, we're done
exit for
else
myStr = mystr & mid(myword, lctr, 1)
end if
next lctr
msgbox mystr

(Watch for typos!)

"news.epix.net" wrote:
>
> Could someone please tell me how to determine the data type of each char of
> a string?
>
> I have worksheets named 'October07'. I need to extract just the month name
> first and then
> the year number.
>
> I would like to loop thru the string until I find an integer character.
>
> Thanks,
> M. Miller
>


--

Dave Peterson
 
Reply With Quote
 
=?Utf-8?B?R2FyeScncyBTdHVkZW50?=
Guest
Posts: n/a
 
      31st Oct 2007
Use the =ISNUMERIC() function
--
Gary''s Student - gsnu200752
 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      31st Oct 2007
Missed year number

=MID(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"0123456789")),99)

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Bob Phillips" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> =LEFT(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"0123456789"))-1)
>
> --
> HTH
>
> Bob
>
> (there's no email, no snail mail, but somewhere should be gmail in my
> addy)
>
> "news.epix.net" <(E-Mail Removed)> wrote in message
> news:006BDD4E-20AD-4C95-92C7-(E-Mail Removed)...
>> Could someone please tell me how to determine the data type of each char
>> of a string?
>>
>> I have worksheets named 'October07'. I need to extract just the month
>> name first and then
>> the year number.
>>
>> I would like to loop thru the string until I find an integer character.
>>
>> Thanks,
>> M. Miller
>>
>>

>
>



 
Reply With Quote
 
Ron Rosenfeld
Guest
Posts: n/a
 
      31st Oct 2007
On Wed, 31 Oct 2007 08:53:26 -0400, "news.epix.net" <(E-Mail Removed)> wrote:

>Could someone please tell me how to determine the data type of each char of
>a string?
>
>I have worksheets named 'October07'. I need to extract just the month name
>first and then
>the year number.
>
>I would like to loop thru the string until I find an integer character.
>
>Thanks,
>M. Miller
>


If your worksheets are all named with the last two characters being numeric,
then

Month = left(ws.name,len(ws.name)-2)
Year = right(ws.name,2) + 2000


--ron
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you determine TYPE of incoming data Mike Microsoft VB .NET 3 15th Jun 2007 05:18 AM
Determine if a text string is really a numeric type? AdamM Microsoft C# .NET 3 22nd Jan 2006 09:32 AM
Convert String Data Type to UniqueIdentifier data type =?Utf-8?B?YW5n?= Microsoft ADO .NET 4 26th Jan 2004 10:58 AM
How do I determine data type? Leanne Microsoft Access Form Coding 2 23rd Oct 2003 08:25 AM
Determine the data type of a column Bob Day Microsoft VB .NET 3 20th Sep 2003 12:54 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:46 PM.