Is Integer

Fire_Chief

Well-known Member
Joined
Jun 21, 2003
Messages
633
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
 

Some videos you may like

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

iknowu99

Well-known Member
Joined
Dec 26, 2004
Messages
1,158
Code:
Sub foobar()
If CInt(Range("A1").Value) <> Range("A1").Value Then
    j = j
Else
    k = k
End If
End Sub
 

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
maybe something like this...
On Error Resume Next
x = WorksheetFunction.Search(".", Range("A1"))
MsgBox IsEmpty(x)
 

Fire_Chief

Well-known Member
Joined
Jun 21, 2003
Messages
633

ADVERTISEMENT

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

Fire_Chief

Well-known Member
Joined
Jun 21, 2003
Messages
633
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
Joined
Jun 21, 2003
Messages
633

ADVERTISEMENT

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
Joined
Apr 19, 2005
Messages
23,707
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
Joined
Apr 28, 2004
Messages
76,263
Office Version
  1. 365
Platform
  1. Windows
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.:)
 

Watch MrExcel Video

Forum statistics

Threads
1,127,133
Messages
5,622,922
Members
415,940
Latest member
franzL

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
Top