LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
KL KL is offline
external usenet poster
 
Posts: 201
Default Not IsNumeric not working - or is it me?

Hi Ed,

"*" isn't the problem, it is the way you loop through cells and delete rows.
You need to delete rows in the inverted order. Also, you have a number of
redundant conditions. Try this code:

Sub test()
LastRow = Cells(Rows.Count, 1).End(xlUp).Row
ScreenUpdating = False
For i = LastRow To 1 Step -1
If IsEmpty(Cells(i, 1)) Or Not IsNumeric(Cells(i, 1)) Then
Rows(i).Delete
End If
Next
End Sub

Regards,
KL

"Ed" wrote in message
...
I'm trying to evaluate all cells down a column and delete all rows with a
non-number in the cell. It was working fine - until I hit "*85"!! The *
threw everthing off. So I was trying to use Not IsNumeric to evaluate the
second character of the cell value. But my code is not working.
Apparently
I'm using it wrong. If anyone can help. I'd appreciate it.

Ed

Do
If .Cells(i, 1).Value = "" Or _
.Cells(i, 1).Value = " " Then
.Cells(i, 1).EntireRow.Delete
j = .Rows.Count
****** Problem area ******
ElseIf Len(.Cells(i, 1).Value) 1 And _
Not IsNumeric(Left(.Cells(i, 1).Value, 2)) Then
****** Problem area ******
.Cells(i, 1).EntireRow.Delete
j = .Rows.Count
Else
i = i + 1
End If
Loop Until i j




 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculate working days but change working week SamB Excel Discussion (Misc queries) 1 September 1st 08 09:17 PM
IsNumeric with array or range Jerry M New Users to Excel 4 April 24th 07 01:29 PM
opposite of IsNumeric thephoenix12 Excel Discussion (Misc queries) 10 June 24th 05 07:37 PM
check Isnumeric, doesnot work well helmekki[_17_] Excel Programming 3 August 7th 04 03:34 AM
Adding sales from a non working day to the previous working day Alex Excel Programming 1 September 19th 03 08:48 AM


All times are GMT +1. The time now is 12:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"