tgifgemini 12 Junior Poster


Hi everybody.
I have a code that formats the "Comments" field row in my spreadsheet. The objective is to begin a new paragraph whenever it encounters a date field within the text data. Below is how it is currently formating the "comments" field in the spreadsheet:

Example 1:
Comments:
9/10/2007 text text text text text text
text text text text text text
text text text text text text
9/15/2007 text text text text text text
text text text text text text
text text text text text text.

So far it is accomplishing that objective.

Questions:-Using the same code below, is there any possibility of tweaking the code to format the spreadsheet such that after writting "Comments:" it will indent and write the rest of the data within the same indentation?

Example 2:

Comments: 9/10/2007: text text text text text
-----------text text text text text text
-----------text text text text text text

-----------9/15/2007: text text text text text
-----------text text text text text text
-----------text text text text text text

Note: The above leading dashes is not part of the data. It's just to mark the indentation.

Below is the code that generates Example 1 above.

Do
            newlinecnt = 0
            Pos = InStr(Pos + 1, mystr, ":")
            If Not Pos = 0 Then
               If Mid(mystr, Pos - 5, 1) = "/" Then
                   mystr = Left(mystr, Pos - 11) & Chr(10) & Mid(mystr, Pos - 10, 10) & Chr(10) & Mid(mystr, Pos + 1)
                   newlinecnt = newlinecnt + 2
                   Pos = Pos + 2
               End If
            End If
Loop While Not Pos = 0
        xlWksht.Cells(ii + 1, 1).Value = mystr

Thanks.
tgif