View Single Post
 
Old 11-26-2013, 10:21 PM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Actually, you'd ordinarily use:
Code:
Sub Demo()
Dim i As Long
For i = 0 To UBound(splitslash)
  If splitslash(i) Like "*[/]*" Then
    Range("H4").Value = splitslash(i)
    Exit For
  End If
Next i
End Sub
or
Code:
Sub Demo()
Dim i As Long
For i = LBound(splitslash) To UBound(splitslash)
  If splitslash(i) Like "*[/]*" Then
    Range("H4").Value = splitslash(i)
    Exit For
  End If
Next i
End Sub
You'd ordinarily start at 0 because, by default, the first array element is 0. You'd only start at 1 if 'Option Base 1' has been set. The 'Exit For' is used because there's no point continuing the loop once the match has been found. The second version allows for cases where the module may or may not use 'Option Base 1'.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote