Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
What would be the possibilities to check that only ASCII chars are used within one file? Thanks in advance once again Markku |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
what sort of file, xls, txt....
Regards, Peter T "Makelei" wrote in message ... Hi, What would be the possibilities to check that only ASCII chars are used within one file? Thanks in advance once again Markku |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
xls and 2003 BR MakeLei "Peter T" wrote: what sort of file, xls, txt.... Regards, Peter T "Makelei" wrote in message ... Hi, What would be the possibilities to check that only ASCII chars are used within one file? Thanks in advance once again Markku |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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" wrote in message ... Hi, xls and 2003 BR MakeLei "Peter T" wrote: what sort of file, xls, txt.... Regards, Peter T "Makelei" wrote in message ... Hi, What would be the possibilities to check that only ASCII chars are used within one file? Thanks in advance once again Markku |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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" wrote in message ... Hi, xls and 2003 BR MakeLei "Peter T" wrote: what sort of file, xls, txt.... Regards, Peter T "Makelei" wrote in message ... Hi, What would be the possibilities to check that only ASCII chars are used within one file? Thanks in advance once again Markku |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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" wrote in message ... 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" wrote in message ... Hi, xls and 2003 BR MakeLei "Peter T" wrote: what sort of file, xls, txt.... Regards, Peter T "Makelei" wrote in message ... Hi, What would be the possibilities to check that only ASCII chars are used within one file? Thanks in advance once again Markku |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
What you now say you want is very different to what you asked in your OP
this is only lightly tested - Private Sub Worksheet_Change(ByVal Target As Range) Dim bIsASCII As Boolean Dim nClr1 As Long, nClr2 As Long Dim ba() As Byte Dim cel As Range For Each cel In Target ba = CStr(cel.Value) If IsNumeric(cel) Then bIsASCII = True Else bIsASCII = IsAllASCII(ba) End If With cel.Interior nClr1 = .ColorIndex nClr2 = 0 If bIsASCII Then If nClr1 = 38 Then nClr2 = xlNone Else If nClr1 < 38 Then nClr2 = 38 End If If nClr2 Then .ColorIndex = nClr2 End With Next End Sub Function IsAllASCII(ba() As Byte) As Boolean Dim bFlag As Boolean Dim i As Long For i = 0 To UBound(ba) - 1 Step 2 If ba(i) < 128 And ba(i + 1) = 0 Then ' it's an ASCII Else bFlag = True Exit For End If Next IsAllASCII = Not bFlag End Function Regards, Peter T "Makelei" wrote in message ... 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" wrote in message ... Hi, xls and 2003 BR MakeLei "Peter T" wrote: what sort of file, xls, txt.... Regards, Peter T "Makelei" wrote in message ... Hi, What would be the possibilities to check that only ASCII chars are used within one file? Thanks in advance once again Markku |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to truncate list of meaningful words greater than 15 chars tomeaningful words of 8 chars. | Excel Worksheet Functions | |||
sum first 2 chars if 3rd is something... | Excel Discussion (Misc queries) | |||
determine if ea value in a col has more than 20 chars | Excel Discussion (Misc queries) | |||
Removing last three chars | Excel Programming | |||
URGENT! check if cell has only ALPHA chars | Excel Programming |