【发布时间】:2016-08-31 04:31:12
【问题描述】:
我正在编写的工作簿用于项目跟踪。在打开页面上,它是当前和即将进行的项目页面。当您按下表单控制按钮时,它会执行下面的代码。下面的代码所做的是阅读工作簿中的每张纸(有 30 张纸),然后是 A5 中所有值为“Project #:”的工作表。当它具有该值时,它将指定值放入指定的行和列。开头有“**”的那一行是行不通的。它下面带“*”的行是我暂时使用的,但它没有超链接,只有工作表名称。
我希望在下面的代码中发生的事情是使“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
【问题讨论】: