+ Reply to Thread
Results 1 to 6 of 6

VBA code for Special Characters?

  1. #1
    Registered User
    Join Date
    09-21-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    41

    VBA code for Special Characters?

    What is the VBA code to check whether or not a value has a special character?
    (aside from using Ascii Code)....

    Cheers!
    Dinosaur1993

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: VBA code for Special Characters?

    can you attach a sample file with desired result ?
    If solved remember to mark Thread as solved

  3. #3
    Registered User
    Join Date
    09-21-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    41

    Re: VBA code for Special Characters?

    Its just like say for instance I have a textbox.

    I will ask the user to enter a name (or any values without special characters (ie.~!@#$%^&*()). I want to check whether or not they have entered a string (and not a character) in the textbox

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: VBA code for Special Characters?

    Hi, dinosaur1993,

    your question is as clear as mud:
    Please Login or Register  to view this content.
    Could you please explain to me how you would call each single part of a string?

    You may use Len and Replace to find out if any special cahracters have been used (or InStr) or you may have a look at this function which might be of help:
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: VBA code for Special Characters?

    Hello dinosaur1993,

    This is probably closer to what you are looking for. This is a Function that will test a single character or multiple characters. It returns True only for letters A to Z (upper case and lower case) and the Space character. Any other character or characters in the string will return a False.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,524

    Re: VBA code for Special Characters?

    This should do
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Macro to replace European characters with non "special" English characters?
    By johanna0507 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-19-2012, 09:13 AM
  2. Special characters
    By dandi10 in forum Excel General
    Replies: 4
    Last Post: 04-11-2012, 01:21 PM
  3. Consolidating VB code (Removing 29 different Special Characters)
    By adgjqetuo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-11-2009, 07:25 AM
  4. VBA Code required for deleting special characters
    By deepikabalaji in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-09-2007, 01:14 PM
  5. [SOLVED] Special characters
    By Matthew S in forum Excel General
    Replies: 10
    Last Post: 09-23-2005, 08:05 PM

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