关闭。这个问题需要更多focused .它目前不接受答案。
想改善这个问题吗?更新问题,使其仅关注一个问题 editing this post .
7年前关闭。
Improve this question
我想知道 1 个扩展名为 .xls 的特定文件夹中有多少文件。
我阅读了数百个带有消息框的示例,但这不是我想要的。
我只想将数字显示为 1 cel。
有没有人愿意帮我解决这个问题?
我无法发布任何尝试,因为我无法开始:-(
此致,
E.
最佳答案
试试下面的代码:
将文件夹的路径分配给变量 FolderPath
在运行以下代码之前。
Sub sample()
Dim FolderPath As String, path As String, count As Integer
FolderPath = "C:\Documents and Settings\Santosh\Desktop"
path = FolderPath & "\*.xls"
Filename = Dir(path)
Do While Filename <> ""
count = count + 1
Filename = Dir()
Loop
Range("Q8").Value = count
'MsgBox count & " : files found in folder"
End Sub
关于file - 计算特定文件夹中的文件并将数字显示到 1 个单元格中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16753701/