Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: VBA

  1. #1
    Board Regular
    Join Date
    Feb 2002
    Posts
    235
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    What is the VBA code to test a cell for its contents i.e. blank, text, number formula etc. Essentially the same info you get with =cell("Type",ref).

  2. #2
    MrExcel MVP Jay Petrulis's Avatar
    Join Date
    Mar 2002
    Location
    Chicago, IL USA
    Posts
    2,040
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-03-24 12:36, 2077delta wrote:
    What is the VBA code to test a cell for its contents i.e. blank, text, number formula etc. Essentially the same info you get with =cell("Type",ref).
    Test if cell has a formula:
    ActiveCell.HasFormula

    If cell is empty:
    IsEmpty(ActiveCell)

    Best way to test if cell is blank or is a formula blank (courtesy of Aladin Akyurek):
    Len(ActiveCell)

    If cell is number:
    WorksheetFunction.IsNumber(ActiveCell)

    If text:
    WorksheetFunction.IsText(ActiveCell)

    To match your formula EXACTLY:
    Evaluate("=Cell(""Type""," & ActiveCell.Address & ")")

    Regards,
    Jay

  3. #3
    Board Regular
    Join Date
    Feb 2002
    Posts
    235
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks,

    This is just what I was looking for.

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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