Excel VBA - Extracting Integers and Characters

  • Thread starter Thread starter ajlove20
  • Start date Start date
A

ajlove20

Hi,

I am trying to write a macro that goes through a list of value
(integers, decimals, and letters). The list is located in column A o
Sheet 1.

Then the code is supposed to create a new sheet and create 3 columns
Integers; Decimals; Letters) and put the values in the respectiv
columns.

The values are randomly placed in column A and I am trying to figur
out how I would be able to manipulate a code that can go through eac
value and determine if it is an Integer, Decimal, or a Letter.

Any help is very much appreciated. Thank you in advance.

a
 
Here's some code to get you started

Sub Reorg()
Dim i As Long
Dim i1 As Long, i2 As Long, i3 As Long

For i = 1 To Cells(Rows.Count, "A").End(xlUp).Row
If IsNumeric(Cells(i, "A").Value) Then
If Int(Cells(i, "A").Value) = Cells(i, "A").Value Then
i1 = i1 + 1
Cells(i, "A").Copy
Destination:=Worksheets("Sheet2").Cells(i1, "A")
Else
i2 = i2 + 1
Cells(i, "A").Copy
Destination:=Worksheets("Sheet2").Cells(i2, "B")
End If
Else
i3 = i3 + 1
Cells(i, "A").Copy Destination:=Worksheets("Sheet2").Cells(i3,
"C")
End If
Next i

End Sub


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Back
Top