View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default Remove Alpha from AlphaNumeric String...

Try the below...The worksheet is not referenced correctly

Sub Macro()
Dim ws As Worksheet
Dim Row_Count As Long, lastrow As Long
Set ws = ActiveWorkbook.Sheets(2)

lastrow = ws.Cells(Rows.Count, 1).End(xlUp).Row - 1
Row_Count = 2
Do Until Row_Count = lastrow
If Trim(ws.Cells(Row_Count, 1)) Like "*[A-Za-z]" Then
ws.Cells(Row_Count, 2).Value = "Alpha"
End If
Row_Count = Row_Count + 1
Loop

End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Benjamin" wrote:

I'd like to see how to remove the alpha character from a cell, and
paste the contents to the cell next to it.
i.e. 430A, changes to 430, so I can strip just the number out of there.

Yesterday I was helped out with finding and alpha, how would I strip just
the numbers out of a text cell. As the numbers and letters are all consider a
text type in this case, in Excel.

Here's my code I used for my last instance. It worked great.

Sub Macro()
Dim Row_Count As Integer
Dim lastrow As Integer
lastrow = (ActiveWorkbook.Sheets(2).Cells(65536, 1).End(xlUp).Row) - 1
Row_Count = "2"

Do Until Row_Count = lastrow
If Right(Trim(Cells(Row_Count, 1)), 1) Like "[A-Za-z]" Then
Cells(Row_Count, 2).Value = "Alpha"
End If
Row_Count = Row_Count + 1
Loop

Sample Data that I'll be running my macro on:
430A
430A
430B
430B
V-57
V-58
V-59
V-60
V-61
V-62