Is Integer

Fire_Chief

Well-known Member
Joined
Jun 21, 2003
Messages
690
Office Version
  1. 365
Platform
  1. Windows
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

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Code:
Sub foobar()
If CInt(Range("A1").Value) <> Range("A1").Value Then
    j = j
Else
    k = k
End If
End Sub
 
Upvote 0
maybe something like this...
On Error Resume Next
x = WorksheetFunction.Search(".", Range("A1"))
MsgBox IsEmpty(x)
 
Upvote 0
I need something that will work in code not in the cell....
 
Upvote 0
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
 
Upvote 0
I tried iknow299 code and get a type mismatch because there may be other things typed in the cells that are not numbers.
 
Upvote 0
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
 
Upvote 0
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.:)
 
Upvote 0

Forum statistics

Threads
1,214,650
Messages
6,120,736
Members
448,988
Latest member
BB_Unlv

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