VBA自动过滤名称

时间:2019-06-19 17:32:25

标签: excel vba

运行selection.autofilter代码时出现错误,无法解决问题。

我正在尝试通过电子表格F列中的名称“ JHILL2”自动过滤

def getHiddenWord():
    file = open('dictionary.txt')
    found = False
    while found == False:
        hiddenWord = input('Enter the hidden word')
        for word in file.readlines():
            if word.strip().lower() == hiddenWord.lower():
                found = True
                return hiddenWord.lower()
                break
            else:
                 continue
        print('I don\'t have this word in my dictionary please try another word')

我试图只返回带有JHILL2的行

0 个答案:

没有答案