我對 VBA 非常陌生,并起草了一些代碼來替換超鏈接的某些部分。它作業得很好,但現在我似乎無法弄清楚如何讓它在整個作業簿上運行。這是我所擁有的:
For Each cell In Range("C13")
If cell.Hyperlinks.Count > 0 Then
If InStr(cell.Hyperlinks(1).Address, original) <> 0 Then
temp = final & Mid(cell.Hyperlinks(1).Address, Len(original) 1)
cell.Hyperlinks(1).Address = temp
End If
End If
Next cell
End Sub
現在我只是用作range("C13")測驗,但理想情況下它會說類似 application.workbooks(1) (但當然這不起作用)。有任何想法嗎?謝謝!
uj5u.com熱心網友回復:
嘗試:
For Each wb In Application.Workbooks
For Each ws In wb.Worksheets
For Each cell In ws.UsedRange
(your code)
Next cell
Next ws
Next wb
使用cell.Value = cell.Value 1多個作業簿/作業表作為一個簡單的測驗為我作業。
uj5u.com熱心網友回復:
看來您正在尋找代碼以查看作業簿中的超鏈接
Dim hLink As Hyperlink
Dim iSh As Worksheet
For Each iSh In ThisWorkbook.Worksheets
For Each hLink In iSh.Hyperlinks
' Your code adapted a little bit
If InStr(hLink.Address, original) <> 0 Then
temp = Final & Mid(hLink.Address, Len(original) 1)
hLink.Address = temp
End If
' End of your code
Next
Next
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/395102.html
下一篇:更新/修改公式VBA
