1
我試圖將excel電子表格中的所有超鏈接拖入新的工作表中。我希望列A顯示超鏈接中的文本,列B顯示超鏈接地址。VBA超鏈接名稱和地址
我已經編寫了下面的代碼,並且列B的所有工作正常,但列A中的值不會全部過來,並且它們不匹配列B中的超鏈接地址。我在做什麼錯誤?
在此先感謝
Sub extract_links()
Dim hyp As Hyperlink
Dim ReadCols As Long
Dim ReadWriteRow As Long
ReadWriteRow = 1
ReadCols = 6
ActiveWorkbook.Sheets(2).Range("a:b").Clear
For c = 1 To ReadCols
For Each hyp In ActiveWorkbook.Sheets(1).Columns(c).Hyperlinks
ActiveWorkbook.Sheets(2).Range("a" & ReadWriteRow).Value = ActiveWorkbook.Sheets(1).Cells(ReadWriteRow, c).Value
ActiveWorkbook.Sheets(2).Range("b" & ReadWriteRow).Value = hyp.Address
ReadWriteRow = ReadWriteRow + 1
Next
Next c
End Sub
感謝您的幫助了! – Doug
不客氣:) –
+ 1好一個:) –