|The function is pretty straight forward, it reads a text string and extracts the specified character or characters. I have it working as a formula in individual cells but would rather have the function so I can use it easily, and where needed including other workbooks.|
It gives a #Value error and I don't know why?
Sample input string "Each M from 6pm to 7:30pm"
Extract the "M" for Monday, "Tu" for Tuesday, "Sa" for Saturday, etc
Public Function getday(eachDay As String) As String
Dim lenIndex As Integer
Dim dow As String
' IF(FIND("Each ",X2,1),MID(X2,6,IF(FIND("from",X2,1)=9,2,1)))
If (WorksheetFunction.Find("from", eachDay, 1) = 9) Then
lenIndex = 2
lenIndex = 1
If (WorksheetFunction.Find("Each", eachDay, 1)) Then
dow = WorksheetFunction.Mid(eachDay, 6, lenIndex)
dow = ""
getday = dow