Results 1 to 5 of 5

Thread: [RESOLVED] How to differentiate bet a number and a character ??

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    63

    Resolved [RESOLVED] How to differentiate bet a number and a character ??

    Hey guys!

    I wanted to know if there is a ISNUM kind of a command which can be used to differentiate between a number and a character..


    Actually, i will be having two kinds of STRINGS in excel.

    1) \\<Characters>\\ example: \\DELCHARNUM\\
    2) \\<Numbers>\\ example: \\1\\

    Now depending on wheather the string is of the first type or the second, ill have to carry out certain actions.. so i just wanted to know how i could differentiate bet the two kinds of Strings shown above..


    Cheers
    Abhilash

  2. #2
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: How to differentiate bet a number and a character ??

    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  3. #3

    Thread Starter
    Member
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    63

    Re: How to differentiate bet a number and a character ??

    hey sid!
    that thread did help.. as in i found bout the IsNumeric func. that shd solve my prob but another thing i require is to get to the number or the character..

    I say that because.. in the excel sheet, there can be normal character strings which have to be treated separately and then there will be strings starting wid 2 backslashes ( \\ ).

    So basically, i first have to chk for the 2 backslashes and then chk if the next character after the 2 backslashes is a number or a character.

    I can use the IsNumeric once i have gone past the 2 backslashes.. but i dun rilli know how to do dat...

    Please advise


    cheers
    Abhilash

  4. #4
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: How to differentiate bet a number and a character ??

    once i have gone past the 2 backslashes.. but i dun rilli know how to do dat...
    Then the MID or the INSTR function will help you.

    Try them...

    here is a quick example. Edit it as per your needs.

    vb Code:
    1. Private Sub CommandButton1_Click()
    2.  
    3. strng = "//1//"
    4. 'or strng = "ads/as//2//sdfa"
    5.  
    6. For i = 1 To Len(strng)
    7.  
    8. If Mid(strng, i, 2) = "//" Then
    9.     Count = i + 2
    10.     Exit For
    11. End If
    12.  
    13. Next i
    14.  
    15. If IsNumeric(Mid(strng, Count, 1)) = True Then
    16.     MsgBox Mid(strng, Count, 1) & " is a number"
    17. End If
    18.  
    19. End Sub
    Last edited by Siddharth Rout; Apr 24th, 2007 at 04:23 AM.
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  5. #5

    Thread Starter
    Member
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    63

    Re: How to differentiate bet a number and a character ??

    Hey Koolsid!!
    This looks like wad i need.. thx

    cheers
    Abhilash

Posting Permissions

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



Click Here to Expand Forum to Full Width