View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
ZoomZoom[_5_] ZoomZoom[_5_] is offline
external usenet poster
 
Posts: 1
Default Newbie VBA: How to test second position in a cell?

I'd examine the value using Mid, then check to see if the Ascii code for
the extracted string lay in the correct range:

Dim str As String
str = Sheet1.Cells(1, 1).Value
If (str < "") Then
If (Asc(Mid(str, 2, 1)) 47 And Asc(Mid(str, 2, 1)) < 58)
Then
Sheet1.Cells(1, 2).Value = True
Else
Sheet1.Cells(1, 2).Value = False
End If
End If

There are probably vastly better ways of doing this though...


---
Message posted from http://www.ExcelForum.com/