> Select Case Asc(Mid(text, pos, 1))
> Case 27 To 255 'CHECK THESE!
> Case Else
The OP did ask for ASCII characters, which is the 128 with codes 0 to 127
and also include non printing characters, such as line breaks below '27'.
However if looking for ANSI and Unicode above 255, with your approach change
Asc to AscW
Regards,
Peter T
"Patrick Molloy" <(E-Mail Removed)> wrote in message
news:E3F0C4BF-E59B-47E1-B9D9-(E-Mail Removed)...
> Option Explicit
> Private Sub Worksheet_Change(ByVal Target As Range)
> If Target.Count = 1 Then
> CheckASCII Target
> End If
> End Sub
> Sub CheckASCII(Target As Range)
> Dim text As String
> Dim ascii As Long
> Dim pos As Long
> text = Target.text
> For pos = 1 To Len(text)
> Select Case Asc(Mid(text, pos, 1))
> Case 27 To 255 'CHECK THESE!
> Case Else
> Target.Interior.ColorIndex = vbRed
> Exit Sub
> End Select
> Next
> End Sub
>
> "Makelei" <(E-Mail Removed)> wrote in message
> news:A1358135-4909-4EE3-884E-(E-Mail Removed)...
>> Hi,
>> I just want to high light the cell with pink. I have about 30 000 rows
>> and
>> 30 columns in use.
>>
>> This is to be used as data is entered to cell. Sub Worksheet_Change(ByVal
>> Target As Range)
>>
>> BR
>> MakeLei
>>
>> "Peter T" wrote:
>>
>>> So are you saying you want to check if any text cells contain characters
>>> in
>>> the range chr(x) where x is between 128 and 255
>>>
>>> Also, could any formula cells return text with these characters.
>>>
>>> For the result do you just want a yes/no answer or any information about
>>> which cells contain non ASCII characte5rs
>>>
>>> Regards,
>>> Peter T
>>>
>>>
>>>
>>> "Makelei" <(E-Mail Removed)> wrote in message
>>> news:10EDE398-46FF-4A91-9563-(E-Mail Removed)...
>>> > Hi,
>>> > xls and 2003
>>> >
>>> > BR
>>> > MakeLei
>>> >
>>> > "Peter T" wrote:
>>> >
>>> >> what sort of file, xls, txt....
>>> >>
>>> >> Regards,
>>> >> Peter T
>>> >>
>>> >> "Makelei" <(E-Mail Removed)> wrote in message
>>> >> news:51794650-72BC-4345-84BF-(E-Mail Removed)...
>>> >> > Hi,
>>> >> > What would be the possibilities to check that only ASCII chars are
>>> >> > used
>>> >> > within one file?
>>> >> >
>>> >> > Thanks in advance once again
>>> >> > Markku
>>> >>
>>> >>
>>> >>
>>>
>>>
>>>
|