+ Reply to Thread
Results 1 to 10 of 10

If cell = number ?

  1. #1
    Forum Contributor
    Join Date
    10-03-2005
    Posts
    183

    If cell = number ?

    Hi

    If ActiveCell.Offset(0, 7).Value = ISNUMBER Then
    ActiveCell = "False"
    End If


    What is wrong here?

  2. #2
    Yngve
    Guest

    Re: If cell = number ?

    Hi Ctech

    Try this
    If ISNUMBER(ActiveCell.Offset(0, 7).Value) Then
    ActiveCell = "False"
    End If


    Regards Yngve


  3. #3
    Forum Contributor
    Join Date
    10-03-2005
    Posts
    183
    I get error "Sub of function not known".

  4. #4
    Art
    Guest

    RE: If cell = number ?

    Try this:

    If IsNumeric(ActiveCell.Offset(0, 7)) Then
    ActiveCell = "False"
    End If

    Also note that an empty cell with trigger this.

    Art

    "Ctech" wrote:

    >
    > Hi
    >
    > If ActiveCell.Offset(0, 7).Value = ISNUMBER Then
    > ActiveCell = "False"
    > End If
    >
    >
    > What is wrong here?
    >
    >
    > --
    > Ctech
    > ------------------------------------------------------------------------
    > Ctech's Profile: http://www.excelforum.com/member.php...o&userid=27745
    > View this thread: http://www.excelforum.com/showthread...hreadid=500831
    >
    >


  5. #5
    Yngve
    Guest

    Re: If cell = number ?



    Hi Ctech

    Typo

    If IsNumeric(ActiveCell.Offset(0, 7).Value) Then
    ActiveCell = "False"
    End If

    Regards Yngve


  6. #6
    Art
    Guest

    RE: If cell = number ?

    Also a good reason to put: Option Explicit at the beginning of your code.

    Your code thought that ISNUMBER is a variable name.

    Art

    "Ctech" wrote:

    >
    > Hi
    >
    > If ActiveCell.Offset(0, 7).Value = ISNUMBER Then
    > ActiveCell = "False"
    > End If
    >
    >
    > What is wrong here?
    >
    >
    > --
    > Ctech
    > ------------------------------------------------------------------------
    > Ctech's Profile: http://www.excelforum.com/member.php...o&userid=27745
    > View this thread: http://www.excelforum.com/showthread...hreadid=500831
    >
    >


  7. #7
    Gary L Brown
    Guest

    RE: If cell = number ?

    If Application.WorksheetFunction.IsNumber(ActiveCell.Offset(0, 7).Value) Then
    ActiveCell.Value = "False"
    End If

    HTH,
    --
    Gary Brown
    gary_brown@ge_NOSPAM.com
    If this post was helpful, please click the ''Yes'' button next to ''Was this
    Post Helpfull to you?''.


    "Ctech" wrote:

    >
    > Hi
    >
    > If ActiveCell.Offset(0, 7).Value = ISNUMBER Then
    > ActiveCell = "False"
    > End If
    >
    >
    > What is wrong here?
    >
    >
    > --
    > Ctech
    > ------------------------------------------------------------------------
    > Ctech's Profile: http://www.excelforum.com/member.php...o&userid=27745
    > View this thread: http://www.excelforum.com/showthread...hreadid=500831
    >
    >


  8. #8
    GB
    Guest

    RE: If cell = number ?

    To build on what Art said,

    If IsNumeric(ActiveCell.Offset(0, 7)) and ActiveCell.Offset(0,7) <> "" Then
    ActiveCell = "False"
    End If

    This (or something similar) will check to make sure that the cell is not
    blank as well.

  9. #9
    Toppers
    Guest

    RE: If cell = number ?

    I think this is what you want:

    If IsNumeric(ActiveCell.Offset(0, 7).Value ) then
    ActiveCell = "False"
    end if

    Your code would compare with a variable IsNumber which wouldn't (doesn't)
    exist.

    "Ctech" wrote:

    >
    > Hi
    >
    > If ActiveCell.Offset(0, 7).Value = ISNUMBER Then
    > ActiveCell = "False"
    > End If
    >
    >
    > What is wrong here?
    >
    >
    > --
    > Ctech
    > ------------------------------------------------------------------------
    > Ctech's Profile: http://www.excelforum.com/member.php...o&userid=27745
    > View this thread: http://www.excelforum.com/showthread...hreadid=500831
    >
    >


  10. #10
    Dave Peterson
    Guest

    Re: If cell = number ?

    One of the differences between application.isnumber (or
    application.worksheetfunction.isnumber) and VBA's isnumeric is how digits
    masquerading as text is treated.

    If the cell is formatted as text and contains 123 ('123), then VBA's isnumeric()
    will be true. Application.isnumber() will return false. The worksheet function
    is much less forgiving--it really has to be a number.

    Ctech wrote:
    >
    > Hi
    >
    > If ActiveCell.Offset(0, 7).Value = ISNUMBER Then
    > ActiveCell = "False"
    > End If
    >
    > What is wrong here?
    >
    > --
    > Ctech
    > ------------------------------------------------------------------------
    > Ctech's Profile: http://www.excelforum.com/member.php...o&userid=27745
    > View this thread: http://www.excelforum.com/showthread...hreadid=500831


    --

    Dave Peterson

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1