From: LondonLad on
Hi
Thank you all for your posts.
In the end I used Val as I felt that this gave less chance of other errors
later.

Regards

Ron

"Helmut Meukel" wrote:

> "LondonLad" <LondonLad(a)discussions.microsoft.com> schrieb im Newsbeitrag
> news:B96BED25-0A88-4124-9E61-3B874330B57D(a)microsoft.com...
> > Hi
> > xStr can contain a string which includes numbers or not contain numbers
> >
> > if it contains numbers I want to edit it.
> >
> > In my example which does not work
> > xStr = "03 Best of Time"
> >
> > If IsNumeric(xStr) Then txtHold.Text = "Yes" Else txtHold.Text = "No"
> >
> > Can you help please
> >
> > Ron
>
>
>
> Ron,
>
> depending on where the number(s) are, Val(xStr) may work.
>
> The ancient Val function returns a Double if the string starts with
> a number. It stops conversion when it encounters a non-numerical
> character. If the string starts with a non-numerical character it
> will return 0. It's not localized, it recognizes only the dot as
> decimal sign.
> Spaces are totally ignored by Val.
>
> Here some examples:
> Val("123 that's for me") will return 123 but
> Val("1, 2, 3, that's for me") will return 1, because there is a
> comma after the 1.
> Val(".25 $") will return 0.25
> Val("$ 125") will return 0, because the string starts with a
> non-numerical character
> Val("5 6 7 8") will return 5678
> Val("- 12" will return -12
>
> If you are certain about how your data looks like,
> and you want speed, Val may be your choice.
>
> Helmut.
>
>
> .
>
From: Rick Rothstein on
Just curious... what "other errors" do you think you would encounter by
using the Like operator as proposed in my first posting?

I'm also curious about the code you plan to use for your If..Then test?

--
Rick (MVP - Excel)


"LondonLad" <LondonLad(a)discussions.microsoft.com> wrote in message
news:9DC2AFF9-E9BC-416A-B95F-A3ED27B01463(a)microsoft.com...
> Hi
> Thank you all for your posts.
> In the end I used Val as I felt that this gave less chance of other errors
> later.
>
> Regards
>
> Ron
>
> "Helmut Meukel" wrote:
>
>> "LondonLad" <LondonLad(a)discussions.microsoft.com> schrieb im Newsbeitrag
>> news:B96BED25-0A88-4124-9E61-3B874330B57D(a)microsoft.com...
>> > Hi
>> > xStr can contain a string which includes numbers or not contain numbers
>> >
>> > if it contains numbers I want to edit it.
>> >
>> > In my example which does not work
>> > xStr = "03 Best of Time"
>> >
>> > If IsNumeric(xStr) Then txtHold.Text = "Yes" Else txtHold.Text = "No"
>> >
>> > Can you help please
>> >
>> > Ron
>>
>>
>>
>> Ron,
>>
>> depending on where the number(s) are, Val(xStr) may work.
>>
>> The ancient Val function returns a Double if the string starts with
>> a number. It stops conversion when it encounters a non-numerical
>> character. If the string starts with a non-numerical character it
>> will return 0. It's not localized, it recognizes only the dot as
>> decimal sign.
>> Spaces are totally ignored by Val.
>>
>> Here some examples:
>> Val("123 that's for me") will return 123 but
>> Val("1, 2, 3, that's for me") will return 1, because there is a
>> comma after the 1.
>> Val(".25 $") will return 0.25
>> Val("$ 125") will return 0, because the string starts with a
>> non-numerical character
>> Val("5 6 7 8") will return 5678
>> Val("- 12" will return -12
>>
>> If you are certain about how your data looks like,
>> and you want speed, Val may be your choice.
>>
>> Helmut.
>>
>>
>> .
>>
From: LondonLad on
Hi Rick
After my post I found that it was possible to get a number in the file extn.
which
was picked up using the like example and I could not figure how to avoid this.
Your code sample was the shortest way to find if numbers were included this
is what I finished up with in my test project.
I split the full string which includes folders and place the results in a
ListBox

txtA = LTrim(Mid(txtAns.List(2), 4))
xStr = Mid(txtAns.List(3), 4)
strAns = Val(xStr)
If strAns > 0 Then strNum = 7 Else strNum = 5
xStr = LTrim(Mid(txtAns.List(3), strNum))
xLen(2) = Len(xStr)
txtB = Left(xStr, xLen(2) - 3)

I am willing to change this if you can show me a better way.
Thanks for your interest.

Regards

Ron

"Rick Rothstein" wrote:

> Just curious... what "other errors" do you think you would encounter by
> using the Like operator as proposed in my first posting?
>
> I'm also curious about the code you plan to use for your If..Then test?
>
> --
> Rick (MVP - Excel)
>
>
> "LondonLad" <LondonLad(a)discussions.microsoft.com> wrote in message
> news:9DC2AFF9-E9BC-416A-B95F-A3ED27B01463(a)microsoft.com...
> > Hi
> > Thank you all for your posts.
> > In the end I used Val as I felt that this gave less chance of other errors
> > later.
> >
> > Regards
> >
> > Ron
> >
> > "Helmut Meukel" wrote:
> >
> >> "LondonLad" <LondonLad(a)discussions.microsoft.com> schrieb im Newsbeitrag
> >> news:B96BED25-0A88-4124-9E61-3B874330B57D(a)microsoft.com...
> >> > Hi
> >> > xStr can contain a string which includes numbers or not contain numbers
> >> >
> >> > if it contains numbers I want to edit it.
> >> >
> >> > In my example which does not work
> >> > xStr = "03 Best of Time"
> >> >
> >> > If IsNumeric(xStr) Then txtHold.Text = "Yes" Else txtHold.Text = "No"
> >> >
> >> > Can you help please
> >> >
> >> > Ron
> >>
> >>
> >>
> >> Ron,
> >>
> >> depending on where the number(s) are, Val(xStr) may work.
> >>
> >> The ancient Val function returns a Double if the string starts with
> >> a number. It stops conversion when it encounters a non-numerical
> >> character. If the string starts with a non-numerical character it
> >> will return 0. It's not localized, it recognizes only the dot as
> >> decimal sign.
> >> Spaces are totally ignored by Val.
> >>
> >> Here some examples:
> >> Val("123 that's for me") will return 123 but
> >> Val("1, 2, 3, that's for me") will return 1, because there is a
> >> comma after the 1.
> >> Val(".25 $") will return 0.25
> >> Val("$ 125") will return 0, because the string starts with a
> >> non-numerical character
> >> Val("5 6 7 8") will return 5678
> >> Val("- 12" will return -12
> >>
> >> If you are certain about how your data looks like,
> >> and you want speed, Val may be your choice.
> >>
> >> Helmut.
> >>
> >>
> >> .
> >>
> .
>
From: Rick Rothstein on
Your original question was basically "how do I determine if there is a digit
in my text"? Now, while I'm not 100% sure what the code snippet you posted
should be doing, it does seem to hint at that you may have been asking the
wrong question initially. I think you saw a path to your end result and
asked us about one step along the way, but I am thinking there is a better
way to get to your ultimate goal. Can you do us a favor? Forget about the
ListBox and what you have split out and not split out... can you just give
us maybe 4 or 5 samples of possible starting text (full path if that is what
you have)(with and without numbers in whatever places numbers could possibly
be located) and how you need each of them to look after being processed by
the parsing part of your code?

--
Rick (MVP - Excel)



"LondonLad" <LondonLad(a)discussions.microsoft.com> wrote in message
news:459AD240-D89F-47D1-9AC1-4EBA43121520(a)microsoft.com...
> Hi Rick
> After my post I found that it was possible to get a number in the file
> extn.
> which
> was picked up using the like example and I could not figure how to avoid
> this.
> Your code sample was the shortest way to find if numbers were included
> this
> is what I finished up with in my test project.
> I split the full string which includes folders and place the results in a
> ListBox
>
> txtA = LTrim(Mid(txtAns.List(2), 4))
> xStr = Mid(txtAns.List(3), 4)
> strAns = Val(xStr)
> If strAns > 0 Then strNum = 7 Else strNum = 5
> xStr = LTrim(Mid(txtAns.List(3), strNum))
> xLen(2) = Len(xStr)
> txtB = Left(xStr, xLen(2) - 3)
>
> I am willing to change this if you can show me a better way.
> Thanks for your interest.
>
> Regards
>
> Ron
>
> "Rick Rothstein" wrote:
>
>> Just curious... what "other errors" do you think you would encounter by
>> using the Like operator as proposed in my first posting?
>>
>> I'm also curious about the code you plan to use for your If..Then test?
>>
>> --
>> Rick (MVP - Excel)
>>
>>
>> "LondonLad" <LondonLad(a)discussions.microsoft.com> wrote in message
>> news:9DC2AFF9-E9BC-416A-B95F-A3ED27B01463(a)microsoft.com...
>> > Hi
>> > Thank you all for your posts.
>> > In the end I used Val as I felt that this gave less chance of other
>> > errors
>> > later.
>> >
>> > Regards
>> >
>> > Ron
>> >
>> > "Helmut Meukel" wrote:
>> >
>> >> "LondonLad" <LondonLad(a)discussions.microsoft.com> schrieb im
>> >> Newsbeitrag
>> >> news:B96BED25-0A88-4124-9E61-3B874330B57D(a)microsoft.com...
>> >> > Hi
>> >> > xStr can contain a string which includes numbers or not contain
>> >> > numbers
>> >> >
>> >> > if it contains numbers I want to edit it.
>> >> >
>> >> > In my example which does not work
>> >> > xStr = "03 Best of Time"
>> >> >
>> >> > If IsNumeric(xStr) Then txtHold.Text = "Yes" Else txtHold.Text =
>> >> > "No"
>> >> >
>> >> > Can you help please
>> >> >
>> >> > Ron
>> >>
>> >>
>> >>
>> >> Ron,
>> >>
>> >> depending on where the number(s) are, Val(xStr) may work.
>> >>
>> >> The ancient Val function returns a Double if the string starts with
>> >> a number. It stops conversion when it encounters a non-numerical
>> >> character. If the string starts with a non-numerical character it
>> >> will return 0. It's not localized, it recognizes only the dot as
>> >> decimal sign.
>> >> Spaces are totally ignored by Val.
>> >>
>> >> Here some examples:
>> >> Val("123 that's for me") will return 123 but
>> >> Val("1, 2, 3, that's for me") will return 1, because there is a
>> >> comma after the 1.
>> >> Val(".25 $") will return 0.25
>> >> Val("$ 125") will return 0, because the string starts with a
>> >> non-numerical character
>> >> Val("5 6 7 8") will return 5678
>> >> Val("- 12" will return -12
>> >>
>> >> If you are certain about how your data looks like,
>> >> and you want speed, Val may be your choice.
>> >>
>> >> Helmut.
>> >>
>> >>
>> >> .
>> >>
>> .
>>
From: LondonLad on
Hi Rick
A bit late to answer this been away for a few days, but here goes.
This is the full path string that I need to extract data from:-

1. F:\Stored Data\Library\Danny Williams\03 Love is Kind.mp3
2. F:\Stored Data\Library\Ken Follet\The Dangers of Time
3. F:\Stored Data\Library\Roger Moore&Tony Curtis\Five Miles to Midnight.avi
4. F:\Stored Data\Library\Barry White\05 Just The Way You Are.wma
5. F:\Stored Data\Library\Hols 07\Italian Lakes.wmv

The first job is to split the Library Folder by File.extn with MP3 and wma
going into the same New Folder then with the music I want just the Artists
Name and the Title of the recording. Some recordings do not have a number in
the Title Section.

Regards

Ron

"Rick Rothstein" wrote:

> Your original question was basically "how do I determine if there is a digit
> in my text"? Now, while I'm not 100% sure what the code snippet you posted
> should be doing, it does seem to hint at that you may have been asking the
> wrong question initially. I think you saw a path to your end result and
> asked us about one step along the way, but I am thinking there is a better
> way to get to your ultimate goal. Can you do us a favor? Forget about the
> ListBox and what you have split out and not split out... can you just give
> us maybe 4 or 5 samples of possible starting text (full path if that is what
> you have)(with and without numbers in whatever places numbers could possibly
> be located) and how you need each of them to look after being processed by
> the parsing part of your code?
>
> --
> Rick (MVP - Excel)
>
>
>
> "LondonLad" <LondonLad(a)discussions.microsoft.com> wrote in message
> news:459AD240-D89F-47D1-9AC1-4EBA43121520(a)microsoft.com...
> > Hi Rick
> > After my post I found that it was possible to get a number in the file
> > extn.
> > which
> > was picked up using the like example and I could not figure how to avoid
> > this.
> > Your code sample was the shortest way to find if numbers were included
> > this
> > is what I finished up with in my test project.
> > I split the full string which includes folders and place the results in a
> > ListBox
> >
> > txtA = LTrim(Mid(txtAns.List(2), 4))
> > xStr = Mid(txtAns.List(3), 4)
> > strAns = Val(xStr)
> > If strAns > 0 Then strNum = 7 Else strNum = 5
> > xStr = LTrim(Mid(txtAns.List(3), strNum))
> > xLen(2) = Len(xStr)
> > txtB = Left(xStr, xLen(2) - 3)
> >
> > I am willing to change this if you can show me a better way.
> > Thanks for your interest.
> >
> > Regards
> >
> > Ron
> >
> > "Rick Rothstein" wrote:
> >
> >> Just curious... what "other errors" do you think you would encounter by
> >> using the Like operator as proposed in my first posting?
> >>
> >> I'm also curious about the code you plan to use for your If..Then test?
> >>
> >> --
> >> Rick (MVP - Excel)
> >>
> >>
> >> "LondonLad" <LondonLad(a)discussions.microsoft.com> wrote in message
> >> news:9DC2AFF9-E9BC-416A-B95F-A3ED27B01463(a)microsoft.com...
> >> > Hi
> >> > Thank you all for your posts.
> >> > In the end I used Val as I felt that this gave less chance of other
> >> > errors
> >> > later.
> >> >
> >> > Regards
> >> >
> >> > Ron
> >> >
> >> > "Helmut Meukel" wrote:
> >> >
> >> >> "LondonLad" <LondonLad(a)discussions.microsoft.com> schrieb im
> >> >> Newsbeitrag
> >> >> news:B96BED25-0A88-4124-9E61-3B874330B57D(a)microsoft.com...
> >> >> > Hi
> >> >> > xStr can contain a string which includes numbers or not contain
> >> >> > numbers
> >> >> >
> >> >> > if it contains numbers I want to edit it.
> >> >> >
> >> >> > In my example which does not work
> >> >> > xStr = "03 Best of Time"
> >> >> >
> >> >> > If IsNumeric(xStr) Then txtHold.Text = "Yes" Else txtHold.Text =
> >> >> > "No"
> >> >> >
> >> >> > Can you help please
> >> >> >
> >> >> > Ron
> >> >>
> >> >>
> >> >>
> >> >> Ron,
> >> >>
> >> >> depending on where the number(s) are, Val(xStr) may work.
> >> >>
> >> >> The ancient Val function returns a Double if the string starts with
> >> >> a number. It stops conversion when it encounters a non-numerical
> >> >> character. If the string starts with a non-numerical character it
> >> >> will return 0. It's not localized, it recognizes only the dot as
> >> >> decimal sign.
> >> >> Spaces are totally ignored by Val.
> >> >>
> >> >> Here some examples:
> >> >> Val("123 that's for me") will return 123 but
> >> >> Val("1, 2, 3, that's for me") will return 1, because there is a
> >> >> comma after the 1.
> >> >> Val(".25 $") will return 0.25
> >> >> Val("$ 125") will return 0, because the string starts with a
> >> >> non-numerical character
> >> >> Val("5 6 7 8") will return 5678
> >> >> Val("- 12" will return -12
> >> >>
> >> >> If you are certain about how your data looks like,
> >> >> and you want speed, Val may be your choice.
> >> >>
> >> >> Helmut.
> >> >>
> >> >>
> >> >> .
> >> >>
> >> .
> >>
> .
>
First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4
Prev: It was a good ride - will miss y'all!
Next: data disapear