Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub LoopThroughString()
- Dim cellWithinRange As Object
- Dim selectedRange As Range
- Dim newText As String
- Dim LookInHere As String
- Dim Counter As Integer
- For Each cell In Selection
- 'Use your own text here
- LookInHere = cell.Value
- For Counter = 1 To Len(LookInHere)
- If (Mid(LookInHere, Counter, 1)) = "0" Then
- newText = newText
- ElseIf (Mid(LookInHere, Counter, 1)) <> "0" Then
- newText = newText & (Mid(LookInHere, Counter, 100))
- Exit For
- End If
- Next
- cell.Value = newText
- newText = ""
- Next cell
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement