1
我想創建一個超鏈接鏈接到基於單元格文本的同一工作簿中的另一工作表中的單元格。我試圖做手工,這裏是結果:Excel宏VBA創建一個基於活動單元格內容的另一個工作表的超鏈接
=HYPERLINK("[Five Ecom - Floor Plan.xlsx]Inventory!" &
ADDRESS(MATCH('8th'!F9,Inventory!$A$1:$A$2000,0),1),'8th'!F9)
'8th'!F9
- 是當前單元格Inventory!$A$1:$A$2000
- 細胞目的地
友好的文本將是範圍同一個當前單元格的內容。
我在這裏特別對字符串操作有困難,所以我決定將代碼分成幾個變量,到目前爲止,我無法生成所需的輸出和結果到運行時錯誤'1004'。如果更換
Public Sub Convert_To_Hyperlinks()
Dim cell As Range
Dim x As String
Dim y As String
Dim z As String
Dim c As String
For Each cell In Intersect(Selection, ActiveSheet.UsedRange)
If cell <> "" Then
c = ActiveCell.Value
x = "=HYPERLINK(""[Five Ecom - Floor Plan.xlsm]Inventory!"" & ADDRESS(MATCH("""
y = """, Inventory!$A$1:$A$2000,0),1),"""
z = """)"
ActiveCell.FormulaR1C1 = x & c & y & c & z
End If
Next
End Sub
這並獲得成功!非常感謝! – rmcalingasan