View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
luis_excelkid luis_excelkid is offline
external usenet poster
 
Posts: 3
Default How do I use VBA or a function to do a certain type of string work

Hi christopher ward:

i would do this:

Dim linea As Integer
linea = 2
do while <YourWorksheet.cells(linea,1).value <""
if (((chr(left(<YourWorksheet.cells(linea,1).value,1 ))=48) and
(chr(left(<YourWorksheet.cells(linea,1).value,1)) <=57))or
((chr(left(<YourWorksheet.cells(linea,1).value,1) )=65)and
(chr(left(<YourWorksheet.cells(linea,1).value,1)) =90))or
((chr(left(<YourWorksheet.cells(linea,1).value,1) )=97)and
(chr(left(<YourWorksheet.cells(linea,1).value,1)) =122)))=true then
do what you want
End If
linea = linea + 1
Loop

this code check if the firt character is a 1-9, a-z, A-Z, and do something,
add an else sentence to do other things if the first character is a symbol.

I hope this would helpful for you, please let me know,
Bye!