Hi. I have a list in column a of letters and numbers. I want to copy
the cells where there are letters (4letters) only and place them in the
same positon in column H - excluding all numbers.
Formula or vb?
Any clues?
An example of you data would help, but
Sub ABC()
Dim rng As Range, cell As Range
Dim s As String, s1 As String
Dim sChr As String, i as Long
Set rng = Range(Cells(1, 1), Cells(Rows.Count, 1).End(xlUp))
For Each cell In rng
s1 = ""
s = cell.Text
If Len(s) >= 4 Then
For i = 1 To Len(s)
sChr = Mid(s, i, 1)
If sChr Like "[A-Za-z]" Then
s1 = s1 & sChr
End If
If Len(s1) >= 4 Then
Cells(cell.Row, "H").Value = s1
End If
Next
End If
Next
End Sub
should work. If you mean only cells that are completely text and the range
contains only cells that are completely numbers stored as numbers or text :
for example
Header1
123
456
689
Header3
234
567
891
Then it would be:
Sub AAAA()
Dim rng as Range, cella s Range
Set rng = Range(Cells(1, 1), Cells(Rows.Count,
1).End(xlUp)).SpecialCells(xlConstants,xlTextValues)
for each cell in rng
cell.offset(0,7).Value = cell.Value
Next
End Sub

Signature
Regards,
Tom Ogilvy
> Hi. I have a list in column a of letters and numbers. I want to copy
> the cells where there are letters (4letters) only and place them in the
> same positon in column H - excluding all numbers.
>
> Formula or vb?
> Any clues?
J.W. Aldridge - 30 Sep 2006 22:32 GMT
worked like a charm....
Thanx !