Number Value Check Question

  • Thread starter Thread starter Kim
  • Start date Start date
K

Kim

Hi, I think this is a quick one:

I have a whole column of values that are formatted as "Date" but some of the
values are actual dates, while some are text. I want to cut and move the text
values and ignore the real dates, but the code below isn't working to pick
out the numbers vs. text.

If ActiveCell Like "#%" Then
ActiveCell.Offset(1, 0).Activate
Else
ActiveCell.Select
Selection.Cut
ActiveCell.Offset(-1, 1).Activate
ActiveSheet.Paste
ActiveCell.Offset(1, -1).Activate
End If

---Thanks!
 
Try this:

Sub test()
Dim rng As Range, lrow As Long, i As Range
lrow = Cells(Rows.Count, 1).End(xlUp).Row
Set rng = Range(Cells(1, 1), Cells(lrow, 1))
For Each i In rng
If Not Application.WorksheetFunction.IsNumber(i) Then
i.Cut i.Offset(, 1)
End If
Next i
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

Back
Top