Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
checking a Cells contents
Hi,
Variations on a theme ! Private Sub Worksheet_Change(ByVal Target As Range) Dim x, Ch If Len(Target) < 9 Then GoTo Xit For x = 1 To 9 Ch = Asc(Mid(Target, x, 1)) Select Case Ch Case Is < 48, Is 57 '0 to 9 If x = 3 Then GoTo Xit Case Is < 65, Is 90 'A to Z 'ALTERNATIVE Case Is < 65, 91 To 96, Is 122 'A to Z, a to z If x < 3 Then GoTo Xit End Select Next x Exit Sub Xit: Application.EnableEvents = False MsgBox "Order is invalid" Target.Select Application.EnableEvents = True End Sub As is, 0 to 9 are allowed for the 3rd char. and A to Z for others. If a to z are also permissible for others, change to the alternative given. Regards, Don "antinoz" wrote in message ... I'm trying to validate data in a column of cells to check that the format is "NNANNNNNN" (N= number A= Alpha I have) all the cell contents are different but have 9 characters containing the alphanumeric format as shown I want to put it in an If statement: so if cell A1 = mask "NNANNNNNNN" cell A2 = "Valid order" |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
checking a Cells contents | Excel Programming | |||
checking a Cells contents | Excel Programming | |||
checking a Cells contents | Excel Programming | |||
Checking contents | Excel Programming | |||
Checking contents | Excel Programming |