本工作簿所在的文件夹里所有xlsx文件列到A列并形成超链接

Sub Sample()
Dim MyName As String, MyPath As String
Dim i As Long
MyPath = ThisWorkbook.Path & "\"
MyName = Dir(MyPath & "*.xlsx")
Do While MyName <> ""
i = i + 1
Cells(i + 1, 1) = MyName
ActiveSheet.Hyperlinks.Add Anchor:=Cells(i + 1, 1), Address:=MyName
MyName = Dir
Loop
End Sub

效果:

本文件夹中的工作簿目录(Excel代码集团)_perl

 

原博客各种作……所以换阵地了,不过每篇都搬过来,实在有点累,想看就自己看吧:http://blog.sina.com.cn/pureiceshadow