Thread: Wildcards
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
properties properties is offline
external usenet poster
 
Posts: 5
Default Wildcards

In my if statement I want to select only cells that start with "8" and are
six characters long.
The wild card does not work. How do I limit the cells selected to match the
criteria above?

T.I.A.



Sub PO_Test()
Dim i As Long
Dim LastRow As Long
Dim strPo As String

LastRow = Range("A2000").End(xlUp).Row

For i = LastRow To 1 Step -1
If Range("A" & i) Like "8*****" Then
strPo = Range("A" & i).Value
ElseIf Range("D" & i) Like "8*****" Then
strPo = Range("D" & i).Value
End If
Range("H" & i).Value = strPo
Next 'i

End Sub