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
 

Some videos you may like

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
55,381
Office Version
  1. 365
Platform
  1. Windows
Are you doing this in VBA?
What is your ultimate goal?
Can you post what you have so far?
 

kathleen

Active Member
Joined
Dec 16, 2002
Messages
295
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
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
55,381
Office Version
  1. 365
Platform
  1. Windows
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.
 

kathleen

Active Member
Joined
Dec 16, 2002
Messages
295

ADVERTISEMENT

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
 

texasalynn

Well-known Member
Joined
May 19, 2002
Messages
8,458
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
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
55,381
Office Version
  1. 365
Platform
  1. Windows
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
 

Watch MrExcel Video

Forum statistics

Threads
1,118,035
Messages
5,569,782
Members
412,292
Latest member
The Bear named Joe
Top