我的Excel工作表有700多行,在第二列中我有html代码中的产品描述。我需要提取始终在......中的特定值。
<div class="something">
<p><strong>Content to remove</strong></p>
<h1>Content to remove</h1>
<p>Content to remove</p>
<h1 class="modelaut">CONTENT TO KEEP</h1>
<p>Content to remove</p>...
</div>
&#34;要保留的内容&#34;在每行中处于不同的位置,但始终在H1标签中,具有特定的类=&#34; modelaut&#34;
感谢您的帮助:)
答案 0 :(得分:0)
在单元格 A1 :
中hfewyuifgd<h1876yhfr4>TREASURE</h1vnc>xv67t4gehsd
这个公式:
=LEFT(MID(A1,FIND(">",A1,FIND("<h1",A1))+1,99990),FIND("<",MID(A1,FIND(">",A1,FIND("<h1",A1))+1,99990))-1)
将返回:
宝
答案 1 :(得分:0)
The Code woulde就是这样。
Sub transString()
Dim vDB, vSplit1, vSplit2
Dim rngDB As Range, i As Long
Set rngDB = Range("b1", Range("b" & Rows.Count).End(xlUp))
vDB = rngDB
For i = 1 To UBound(vDB, 1)
vSplit1 = Split(vDB(i, 1), "<h1 class=" & Chr(34) & "modelaut" & Chr(34) & ">")
vSplit2 = Split(vSplit1(1), "</h1>")
vDB(i, 1) = "<h1 class=" & Chr(34) & "modelaut" & Chr(34) & ">" & vSplit2(0) & "</h1>"
Next i
rngDB = vDB
End Sub
答案 2 :(得分:0)