# Is Integer

#### Fire_Chief

##### Well-known Member
How can I tell if Cell G22 is an integer?

I have tried combinations of If Range("G22").value = integer ... ect.

Can't get it

Help

Marty

### Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

#### texasalynn

##### Well-known Member
will this work?
Code:
``=IF(MOD(G22,1)=0,"yes","no")``

#### iknowu99

##### Well-known Member
Code:
``````Sub foobar()
If CInt(Range("A1").Value) <> Range("A1").Value Then
j = j
Else
k = k
End If
End Sub``````

#### Jonmo1

##### MrExcel MVP
maybe something like this...
On Error Resume Next
x = WorksheetFunction.Search(".", Range("A1"))
MsgBox IsEmpty(x)

#### Fire_Chief

##### Well-known Member

I need something that will work in code not in the cell....

#### Fire_Chief

##### Well-known Member
This is the code I am using:

Sub CHECK_FOR_DUPLICATES()

lastrow = Range("Q34").End(xlUp).Row
For X = lastrow To 1 Step -1

If Application.WorksheetFunction.CountIf(Range("L5:Q33" & X), Range("Q" & X).Text) > 1 Then
If Range("Q" & X).Value = "" Then
GoTo JUMP3
ElseIf Range("Q" & X).Value = "CONSOLE" Then
GoTo JUMP3
ElseIf Range("Q" & X).Value = "PHONE" Then
GoTo JUMP3

'Here is where I want it to goto jump3 if it is an Integer

Stop
GoTo JUMP3

End If
Range("Q" & X).Activate
MsgBox "IT APPEARS YOU HAVE 2 PEOPLE ON " & ActiveCell.Value
STOP_SUB = "YES"
Exit Sub
'Range("E" & x).Interior.ColorIndex = 4
JUMP3:

End If
Next X
End Sub

#### Fire_Chief

##### Well-known Member

I tried iknow299 code and get a type mismatch because there may be other things typed in the cells that are not numbers.

#### Richard Schollar

##### MrExcel MVP
Do an additional test to see if it is numeric before you run the type conversion ie:

Code:
``````If IsNumeric(Range("A1").Value) Then
If CLng(Range("A1").Value) = Range("A1").Value Then
'etc etc``````

#### Norie

##### Well-known Member
You can test for a number using IsNumeric, then you could test if that number is an integer.

By the way I would recommend you restructure the code.

How exactly is hard to say as the way it is currently makes it hard to interpret.

Replies
10
Views
98
Replies
5
Views
430
Replies
19
Views
334
Replies
3
Views
106
Replies
2
Views
33

1,127,529
Messages
5,625,351
Members
416,096
Latest member
forevans

### 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.

### Which adblocker are you using?

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

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