STRING SUM UNTIL

A

ancora

in A column i have many records as string like

(A)
one
two
three
four five
ten
ten nine
nine
.....
.....
.....
etc

with vba i would find all the SUM string that have at least "x"
characters including spaces between the strings, for example if i
would like to find the sum string with "8" characters at least, I'll
get in column B those SUM strings like follow

(B)
one nine
two nine
ten nine

where all the found strings have 8 characters
 
M

macropod

Hi ancora,

Try:
Sub Test()
Dim i as Long
Dim j as Long
With ActiveSheet
For i = 1 To .UsedRange.Rows.Count
If Len(.Range("A" & i)) > 7 Then
j = j + 1
.Range("B" & j).Value = .Range("A" & i).Value
End If
Next
End With
End Sub

Cheers
 
A

ancora

Hi ancora,

Try:
Sub Test()
Dim i as Long
Dim j as Long
With ActiveSheet
For i = 1 To .UsedRange.Rows.Count
If Len(.Range("A" & i)) > 7 Then
j = j + 1
.Range("B" & j).Value = .Range("A" & i).Value
End If
Next
End With
End Sub

Cheers

--
macropod
[MVP - Microsoft Word]
-------------------------



ancora said:
in A column i have many records asstringlike
(A)
one
two
three
four five
ten
ten nine
nine
....
....
....
etc
with vba i would find all theSUMstringthat have at least "x"
characters including spaces between the strings, for example if i
would like to find thesumstringwith "8" characters at least, I'll
get in column B thoseSUMstrings like follow
(B)
one nine
two nine
ten nine
where all the found strings have 8 characters- Nascondi testo tra virgolette -

- Mostra testo tra virgolette -

thanks a lot for your help
but it works only taking string with 8 characters and past to column b
I want to find all the combination which the string lenght is 8
characters
like my example, pls help again
 
M

macropod

Hi ancora,

If you want to find an exact number of characters, change the line:
If Len(.Range("A" & i)) > 7 Then
to
If Len(.Range("A" & i)) =8 Then
(for 8 characters)

Cheers

--
macropod
[MVP - Microsoft Word]
-------------------------

ancora said:
Hi ancora,

Try:
Sub Test()
Dim i as Long
Dim j as Long
With ActiveSheet
For i = 1 To .UsedRange.Rows.Count
If Len(.Range("A" & i)) > 7 Then
j = j + 1
.Range("B" & j).Value = .Range("A" & i).Value
End If
Next
End With
End Sub

Cheers

--
macropod
[MVP - Microsoft Word]
-------------------------



ancora said:
in A column i have many records asstringlike
(A)
one
two
three
four five
ten
ten nine
nine
....
....
....
etc
with vba i would find all theSUMstringthat have at least "x"
characters including spaces between the strings, for example if i
would like to find thesumstringwith "8" characters at least, I'll
get in column B thoseSUMstrings like follow
(B)
one nine
two nine
ten nine
where all the found strings have 8 characters- Nascondi testo tra virgolette -

- Mostra testo tra virgolette -

thanks a lot for your help
but it works only taking string with 8 characters and past to column b
I want to find all the combination which the string lenght is 8
characters
like my example, pls help again
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top