Look up cell content by type and copy to different cell

S

Sam Huleis

I have a column of cells that contain "date" cells, "text" cells and "number"
cells. Is there a function that I can use to enable me to copy the content
of a "date" cell into one column, "text" cell into a second column and
"number" cell into a third column? The version of my product is Excel 2003

Thank you
 
O

Otto Moehrbach

Sam
Something like this macro may work for you. I assumed your original
data is in Column A starting with A2 down, Dates go in Column B, Text in
Column C and Numbers in Column D. HTH Otto
Sub DTS()
Dim rColA As Range
Dim i As Range
Set rColA = Range("A2", Range("A" & Rows.Count).End(xlUp))
Application.ScreenUpdating = False
For Each i In rColA
If IsDate(i.Value) Then
i.Copy Range("B" & Rows.Count).End(xlUp).Offset(1)
GoTo NextCell
End If
If IsNumeric(i.Value) Then
i.Copy Range("D" & Rows.Count).End(xlUp).Offset(1)
GoTo NextCell
End If
i.Copy Range("C" & Rows.Count).End(xlUp).Offset(1)
NextCell:
Next i
Application.ScreenUpdating = True
End Sub
 

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