ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   IS Text? (https://www.excelbanter.com/excel-programming/298761-text.html)

Ed[_20_]

IS Text?
 
I'm trying to have this piece of code delete rows that non-numeric. I
thought this
would work but it does not run.

Any ideas or other options?
T.I.A.


Sub Step08_Non_Ship()

Dim LastRow As Long
Dim i As Long

LastRow = Range("A12000").End(xlUp).Row
For i = LastRow To 1 Step -1
If IsText(Range("D" & i).Value) Then
Range("A" & i).EntireRow.Delete
End If
Next 'i

End Sub



JWolf

IS Text?
 
Change line to: If WorksheetFunction.Istext(Range("D" & i).Value) Then

Ed wrote:
I'm trying to have this piece of code delete rows that non-numeric. I
thought this
would work but it does not run.

Any ideas or other options?
T.I.A.


Sub Step08_Non_Ship()

Dim LastRow As Long
Dim i As Long

LastRow = Range("A12000").End(xlUp).Row
For i = LastRow To 1 Step -1
If IsText(Range("D" & i).Value) Then
Range("A" & i).EntireRow.Delete
End If
Next 'i

End Sub



Chris

IS Text?
 
try this

LastRow = Range("A12000").End(xlUp).Ro
For i = LastRow To 1 Step -
If WorksheetFunction.N(Range("D" & i).Value) = 0 The
Range("A" & i).EntireRow.Delet
End I
Next '


----- Ed wrote: ----

I'm trying to have this piece of code delete rows that non-numeric.
thought thi
would work but it does not run

Any ideas or other options
T.I.A


Sub Step08_Non_Ship(

Dim LastRow As Lon
Dim i As Lon

LastRow = Range("A12000").End(xlUp).Ro
For i = LastRow To 1 Step -
If IsText(Range("D" & i).Value) The
Range("A" & i).EntireRow.Delet
End I
Next '

End Su




Harlan Grove[_5_]

IS Text?
 
"?B?Y2hyaXM=?=" wrote...
try this:

LastRow = Range("A12000").End(xlUp).Row
For i = LastRow To 1 Step -1
If WorksheetFunction.N(Range("D" & i).Value) = 0 Then
Range("A" & i).EntireRow.Delete
End If
Next 'i

...

No, test this! What happens when some cell in column D just happens to evaluate
to zero as a numeric value?

--
To top-post is human, to bottom-post and snip is sublime.

Chris

IS Text?
 
Well, actually its not supported in VBA anyway
----- Harlan Grove wrote: ----

"?B?Y2hyaXM=?=" wrote..
try this
LastRow = Range("A12000").End(xlUp).Ro

For i = LastRow To 1 Step -
If WorksheetFunction.N(Range("D" & i).Value) = 0 The
Range("A" & i).EntireRow.Delet
End I
Next '

..

No, test this! What happens when some cell in column D just happens to evaluat
to zero as a numeric value

-
To top-post is human, to bottom-post and snip is sublime


Dana DeLouis[_3_]

IS Text?
 
Would this idea work for you? Not sure if you want to test formulas for
text though, but it's included.

Sub Demo()
Dim Rng As Range
'Use Column A to determine range of Column D
Set Rng = Range([A1], [A12000].End(xlUp)).Offset(0, 3)
On Error Resume Next
Rng.SpecialCells(xlCellTypeConstants, xlTextValues).EntireRow.Delete
Rng.SpecialCells(xlCellTypeFormulas, xlTextValues).EntireRow.Delete
ActiveSheet.UsedRange
End Sub

--
Dana DeLouis
Using Windows XP & Office XP
= = = = = = = = = = = = = = = = =


"Ed" wrote in message
...
I'm trying to have this piece of code delete rows that non-numeric. I
thought this
would work but it does not run.

Any ideas or other options?
T.I.A.


Sub Step08_Non_Ship()

Dim LastRow As Long
Dim i As Long

LastRow = Range("A12000").End(xlUp).Row
For i = LastRow To 1 Step -1
If IsText(Range("D" & i).Value) Then
Range("A" & i).EntireRow.Delete
End If
Next 'i

End Sub






All times are GMT +1. The time now is 07:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com