An IF a MID and a isNumeric

kathleen

Active Member
Joined
Dec 16, 2002
Messages
295
I have this text value "6100000"

I am trying to write an if statement to check if the first character of this text string is numeric than to skip it and move on to the next row, no matter what I do I can't get it to work.

Help please
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Are you doing this in VBA?
What is your ultimate goal?
Can you post what you have so far?
 
Upvote 0
Thanks I am attempting to do this in vba. I would love to post but I can't get anything but an error.

Thanks again in advance
 
Upvote 0
You need to give more details on the process. It looks like maybe you want to loop on a specific range. If so what is the range? What do you want it to do if it does NOT find a numeric value?

The more details you give us, the better the answer we can provide for you.
 
Upvote 0
If the result is not numeric I delete the row. I

I have mixed data that is being evaluated in this loop. I only want to retain the results where the cell is a number. I can handle all the other code, its this statement that is causing me issues.

=ISNUMBER(MID(C15,1,1)) is returning False

Based on the value "6140000" I would assume this statement would return TRUE and in fact is not

Thanks again

Columns("A:A").Select
Range("A1:A5000").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range( _
"AP2"), Unique:=True

Range("AP2").Select
Do While ActiveCell.Value <> ""

' Insert if statement here
' If its numeric skip and move on
' If its text DeleteTheRow


ActiveCell.Offset(1, 0).Select

Loop
 
Upvote 0
kathleen said:
Thanks I am attempting to do this in vba. I would love to post but I can't get anything but an error.

Thanks again in advance

can you copy your code and paste it here. that would be a help in someone trying to assist
 
Upvote 0
Try this macro (designed to run on column C):
Code:
Sub MyDelete()

    Dim i As Long
    
    For i = Range("C65536").End(xlUp).Row To 1 Step -1
        If Not IsNumeric(Left(Cells(i, "C"), 1)) Then Rows(i).EntireRow.Delete
    Next i
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,217,435
Messages
6,136,606
Members
450,021
Latest member
Jlopez0320

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top