Excel精英培训网

 找回密码
 注册
数据透视表40+个常用小技巧,让你一次学会!
查看: 1568|回复: 3

请问我的多重判断语句错在哪里?

[复制链接]
发表于 2012-10-12 20:17 | 显示全部楼层 |阅读模式
Dim Myfile  As String, ssr As String
Myfile = Dir(ThisWorkbook.Path & "/2012*.xls")
Myfile = Dir
   Debug.Print Myfile
    ssr = "/名称.xls"
     If Application.WorksheetFunction.Search("六合", Myfile) > 0 Then
     ssr = "/六合.xls"
     ElseIf Application.WorksheetFunction.Search("老莱", Myfile) > 0 Then
     ssr = "/老莱.xls"
     ElseIf Application.WorksheetFunction.Search("龙河", Myfile) > 0 Then
     ssr = "/龙河.xls"
     End If
excel精英培训的微信平台,每天都会发送excel学习教程和资料。扫一扫明天就可以收到新教程
发表于 2012-10-12 20:22 | 显示全部楼层
Dir如果能查到符合文件名要求的文件,则只返回文件名,否则返回空值
你把判断里的“/”去掉
回复

使用道具 举报

发表于 2012-10-12 21:48 | 显示全部楼层
第一个错误:斜杠“/”用错了,应该是“\”
回复

使用道具 举报

发表于 2012-10-12 21:51 | 显示全部楼层
Myfile = Dir(ThisWorkbook.Path & "\","*.xls")
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|Excel精英培训 ( 豫ICP备11015029号 )

GMT+8, 2024-4-29 03:10 , Processed in 1.423992 second(s), 19 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表