• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Finding the position of underlined word in string

mouaffaq

New Member
Hi guys;

Please help in this>

I have column A have data with 1 or more underlined word, i need to find the position of each underlined word in each string in cells;

i.e.

Hi How are you guys.

Result is 2,4. in cell B.

Could be one word or more.

Thanks A Lot.
 
Hi ,

See the attached file.

Narayan

salam Bro
when applying the code to the whole data there were some cells without data in, and some with errors in calculating info for wordID,
you can find data in http://www.Almutadaber.com/excel.xlsx
there are 4 sheets.
data is in arabic,

kindly note that data to be calculated is in column B and your procedure should fill data in column D

I appreciate if you can help me in this.

Thanks
 
salam Bro
when applying the code to the whole data there were some cells without data in, and some with errors in calculating info for wordID,
you can find data in http://www.Almutadaber.com/excel.xlsx
there are 4 sheets.
data is in arabic,

kindly note that data to be calculated is in column B and your procedure should fill data in column D

I appreciate if you can help me in this.

Thanks

Const CHARACTERSET = "á ã ä å æ Ç È É Ê Ë ì í Î Ï ð ñ ò ó Ô õ ö ø Ù ú Û Ü Ý Þ ß á ã ä å æ ì í ð ñ ò ó õ ö ø ú"
 
Hi ,

The characters mentioned in your latest post are not really characters from Arabic. I am not too sure that this will work with Arabic characters.

Narayan
 
Hi ,

The characters mentioned in your latest post are not really characters from Arabic. I am not too sure that this will work with Arabic characters.

Narayan



I got this code but not workking 100% correct
can you help with modifying it?

Private Sub CommandButton1_Click()
Dim oCell As Range
Dim strTest As String
Dim strArray() As String
Dim X As Integer
Dim Y As Integer
Dim intLenStr() As Integer
Dim intStrIndex As String
Dim intStart As Integer
Dim strPos As String
Dim intCount As Integer
Dim i As Integer

Application.ScreenUpdating = False

On Error GoTo errHandle
For Each oCell In Range("A:A")
oCell.Offset(0, 1).ClearContents
intCount = intCount + 1
strTest = oCell.Value
strArray = Split(strTest, " ")
X = LBound(strArray)
Y = UBound(strArray)

ReDim intLenStr(X To Y)

intStart = 1
For i = X To Y
intStrIndex = i + 1 'Index the current string.
intLenStr(i) = Len(strArray(i))
With oCell.Characters(Start:=intStart, Length:=intLenStr(i)).Font
If .Underline = xlUnderlineStyleSingle Then
oCell.Offset(0, 1) = oCell.Offset(0, 1) & intStrIndex & ".."
End If
End With
intStart = intStart + intLenStr(i) + 1
Next i
Next oCell

Application.ScreenUpdating = True

errHandle:
Application.ScreenUpdating = True
MsgBox (intCount - 1) & " Rows checked", vbInformation
End Sub
 
Back
Top