英文:
Renaming a file path for use in excel
问题
='C:\user\Sonny\desktop[Book1.xlsx]sheet1'!$A$1
你好,我有上面的引用来引用一个已关闭的工作簿。您能建议另一种方法,以便我不需要指定用户\sonny\,因为该文件由多个用户使用?并且它在Excel中作为一个关闭的引用工作?
感谢您的帮助。
谢谢
我做了一些搜索,但找不到答案。
英文:
='C:\user\Sonny\desktop[Book1.xlsx]sheet1'!$A$1
Hello, i have the above to reference a closed workbook. Could you advise another way so that i don't need to specify the user\sonny\ as the file is used by several users? and that it works on excel as a closed reference?
Appreciate your assistance.
Thanks
I did some search, I couldn't find the answer.
答案1
得分: 1
以上评论问到其他用户是否正在尝试访问Sonny的桌面,问题有点不太清楚。
我会理解您的问题是您想让引用指向当前用户的桌面。例如,如果Sonny打开文件,它将指向C:\users\Sonny\desktop,但如果Kevin打开文件,它将指向C:\users\Kevin\desktop。如果是这样的话:
如果您希望引用指向当前用户的桌面,
选项1:VBA
Environ("USERPROFILE") & "\desktop"
选项2:公式。但请注意 - 这只会给您当前文件保存的文件夹,因此用户必须将此文件保存在其桌面上。然后,您可以与文件名和工作表/范围引用连接起来。
=LEFT(CELL("filename"),FIND("[",CELL("filename"))-1)
英文:
Question is a little unclear - above comments have asked if other users are trying to access Sonny's desktop.
I will take your question to mean that you want the reference to point to the current user's desktop. For example if Sonny opens the file it will point to C:\users\Sonny\desktop, but if Kevin opens the file it will point to C:\users\Kevin\desktop. If that is the case:
If you want the reference to point to the current user's desktop,
Option1: VBA
Environ("USERPROFILE") & "\desktop\"
Option2: Formulas. But - this will only give you the folder that the current file is saved in, so the user must save this file on their desktop. Then you can concatenate with the file name and sheet / range reference.
=LEFT(CELL("filename"),FIND("[",CELL("filename"))-1)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论