0
我正在使用的工作簿用於項目跟蹤。在開始頁面上,這是當前的&即將推出的項目頁面。當你按下一個表格控制按鈕時,它執行下面的代碼。以下代碼所做的是讀取工作簿中的每張工作表(有30張),然後是A5中所有具有值「Project#:」的工作表。當它具有該值時,它將把指定的值放入指定的行和列中。開始時帶「**」的行是不起作用的行。下面帶「*」的行是我暫時使用的,但沒有超鏈接,只是表名。Excel VBA代碼超鏈接到其他工作表
我想在代碼中發生下面就是讓行「A」包含的表名作爲文本和超鏈接到表
For Each ws In ThisWorkbook.Worksheets
If ws.Range("A5") = "Project # :" And ws.Range("E16") = "" Then
x = .Range("B" & Rows.Count).End(xlUp).Offset(1).row
**.Cells(x, "A").Formula = "=ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:= _'" & ws.Name & "'"
*.Cells(x, "A").Value = ws.Name 'classifying number
.Cells(x, "B").Formula = "='" & ws.Name & "'!$B$5" 'Project #
.Cells(x, "C").Formula = "='" & ws.Name & "'!$A$1" 'Project Name
.Cells(x, "D").Formula = "='" & ws.Name & "'!$B$8" 'Project Engineer
.Cells(x, "E").Formula = "='" & ws.Name & "'!$B$11" 'In-service Due
.Cells(x, "F").Formula = "='" & ws.Name & "'!$E$6" '30% Due
.Cells(x, "G").Formula = "='" & ws.Name & "'!$F$13" '30% Success
.Cells(x, "H").Formula = "='" & ws.Name & "'!$E$7" '60% due
.Cells(x, "I").Formula = "='" & ws.Name & "'!$F$14" '60% Success
.Cells(x, "J").Formula = "='" & ws.Name & "'!$E$8" '90% due
.Cells(x, "K").Formula = "='" & ws.Name & "'!$F$15" '90% Success
.Cells(x, "L").Formula = "='" & ws.Name & "'!$E$5" 'Material Forecast due date
.Cells(x, "M").Formula = "='" & ws.Name & "'!$F$11" 'Materials Forecast Success
.Cells(x, "N").Formula = "='" & ws.Name & "'!$B$15" 'Non Stores Items
.Cells(x, "O").Formula = "='" & ws.Name & "'!$B$16" 'Non Stores Items Ordered on time
.Cells(x, "P").Formula = "='" & ws.Name & "'!$A$17" 'Non Stores Items Success
End If
Next
End With
這是完美的!我一直試圖弄清楚這一點,非常感謝你! –