Visual Basic Crew Help!

Discussion in 'OT Technology' started by cheet, Aug 10, 2004.

  1. cheet

    cheet OT Supporter

    Joined:
    Mar 22, 2004
    Messages:
    13,235
    Likes Received:
    3
    Location:
    CA
    I am doing a project for work and am working on a macro to go through a certain excel file. I need to test if the contents of a cell have something like a letter in them or some other character, or if it's just a number. Is there some function that I can use to test whether the value is an integer?



    FYI: Simply visually looking through each cell is out of the question, there are 62,000 rows.
     
  2. Slid.

    Slid. I'm a guy.

    Joined:
    Oct 25, 2001
    Messages:
    1,928
    Likes Received:
    0
    Location:
    NH
    Well - through excel you can use "=ISNUMBER(fieldvalue)" like "=ISNUMBER(A)" and it would return false. I don't recall any VB commands to tell you if a value is a string or not BUT you could just as easily make your own function.

    Just define a variable with a-z listed in it then run a for loop on each of the 26 characters comparing it to your cell - if there is a match then it's a string, otherwise it's not. You'd also want to add characters like $%&* and so on. Make sure when comparing you compare both as either lowercase (lcase) or uppercase (ucase) in case there is any deviation.
     
  3. Yep

    Yep Knick knack paddy whack, give the old dog a bone

    Joined:
    Jan 22, 2001
    Messages:
    4,603
    Likes Received:
    0
    Location:
    South Jersey
    Do you already know how to get the cell contents from the excel page? Visual Basic works very well with Excel. And it shouldnt be too big of a deal to do something like this.

    Also, are the cells containing data predictable or are they scattered around the worksheet and workbook?
     

Share This Page