|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
回复 14楼 高玉甫 的帖子
好像没有意义,因为这个程序是Open事件,就是每次打开工作簿是都要运行一次,这样就会覆盖原来的日期:
Private Sub Workbook_Open()
Dim myPath$, myFile$, m As Integer
Application.ScreenUpdating = False
myPath = ThisWorkbook.Path & "\"
myFile = Dir(myPath & "*.*")
m = 1
With Sheets("02")
.UsedRange.Offset(1, 0).Clear
Do While myFile <> ""
If myFile <> ThisWorkbook.Name Then
m = m + 1
.Hyperlinks.Add Anchor:=.Cells(m, 2), Address:=myPath & myFile, TextToDisplay:=Split(myFile, ".")(0)
End If
myFile = Dir
Loop
.Range("A2").Value = 1
If m > 2 Then .Range("A2").AutoFill Destination:=.Range("A2").Resize(m - 1), Type:=xlFillSeries
.Range("C2").Resize(m - 1) = Date'C 列写日期
End With
Application.ScreenUpdating = True
End Sub |
|