Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Mar 2002
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Text or Number (Excel 2003 VBA)

    I need check the data in the speardsheet to see if there is any text entered instead of numbers. Entries such as <1 or +1 or - 1 (with space between - and 1) screw up my code. Something like.

    For Each CurrentCell In Database

    If CurrentCell.Value = Text or not number of something Then
    msgbox CurrentCell.Value
    End If

    Next CurrentCell

    Thanks

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Text or Number (Excel 2003 VBA)

    Try

    If Application.WorksheetFunction.IsText(CurrentCell) Then

  3. #3
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Dallas, Texas, USA
    Posts
    1,680
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Text or Number (Excel 2003 VBA)

    A macro that would search your entire sheet [or database] and then return a message box identifying the suspect cells would be really neat. Building such a macro is "out of my league" but, a simple formula like the following can be copied across and down to quickly reveal where trouble lurks...

    =IF(ISNONTEXT(A1),"OK","RED ALERT")

    Change the cell reference to suit your needs. A bit simplistic for sure but it would work if you just wanted to quickly identify problem cells...

    <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>
    - Ricky

Posting Permissions

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