Thursday, February 23, 2012


Sentence sits in A1
skip a line
in row 3, we have:
startPos spacePos wordLength word
in row 4, we have
1 =FIND(" ", Sentence, A4) =B4-A4 =MID(Sentence, A4, C4)
in row 5 we have:
=B4+1 =FIND(" ", Sentence, A5) =B5-A5 =MID(Sentence, A5, C5)

Sub SplitString()
    sentence = "The rain in Spain stays mainly in the plain"

    startpos = 1
    Spacepos = InStr(startpos, sentence, " ")
    wordlength = Spacepos - startpos
    word = Mid(sentence, startpos, wordlength)
    Debug.Print word
   
    startpos = Spacepos + 1
    Spacepos = InStr(startpos, sentence, " ")
    wordlength = Spacepos - startpos
    word = Mid(sentence, startpos, wordlength)
    Debug.Print word
   
End Sub

look over ch 3 in hands on book, do the practice exercises

Formulas book, we started ch 6, dates and times
in Excel, dates are really OFFSETS from Jan 0, 1900
really just a number
that it looks like a date is just formatting

No comments:

Post a Comment