Consulting

Results 1 to 20 of 24

Thread: Best loop to use?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Best loop to use?

    I need to search for "Ii" and replace w/ "II"
    also "Iii" and w/ "III"
    I also need to be careful that "Ii" is treated as a separate word and not as if it were in the middle of a string. What is happening is I am converting the string to Proper, and roman numerals are being changed to Proper, but I need them to remain in Upper case.

    I am here:
    [vba]For i = 2 To LastRow
    Range("D" & i).Find("ii").Replace ("II")
    Next i[/vba]
    [vba]
    LastRow = Range("D" & Rows.Count).End(xlUp).Row
    For i = 2 To LastRow
    Range("E" & i) = Application.WorksheetFunction.Proper(Trim(Range("D" & i)))
    Next i
    For i = 2 To LastRow
    Range("D" & i).Find("ii").Replace ("II")
    Next i
    [/vba]
    Last edited by YellowLabPro; 04-07-2007 at 12:34 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •