Este fórum está sendo desativado

Depois de 9 anos, este fórum será desativado. Mas calma.... estamos migrando para uma comunidade no DISCORD. Junte-se a nós.

ENTRAR PARA DISCORD

Dúvidas sobre cálculos, funções simples e aninhadas, fórmulas matriciais, etc.
  • Avatar do usuário
#20841
Olá malta,

Ando aqui com um dilema e após várias pesquisas, ainda não consegui resolver.

Imaginem que tenho o nome "Domingo" na célula A1. O que eu queria fazer, era procurar num determinado directório se existe algum ficheiro com esta palavra no seu nome.

É possível fazer isto sem ser através de VBA? Só com fórmulas?
#20842
Boa tarde!!
Para formulas veja:
https://trumpexcel.com/list-of-file-nam ... -in-excel/

Para VBA veja:
Código: Selecionar todos
Sub AleVBA_4209()
'Fonte: http://stackoverflow.com/questions/10380312/loop-through-files-in-a-folder-using-vba
    Dim MyObj As Object, MySource As Object, file As Variant
   file = Dir("C:\Users\AleVBA\Downloads\")
   While (file <> "")
      If InStr(file, "NomeDoArquivo") > 0 Then
         MsgBox "Foi encontrado " & file
         Exit Sub
      End If
     file = Dir
  Wend
End Sub
Att
#20872
alexandrevba escreveu:Boa tarde!!
Para formulas veja:
https://trumpexcel.com/list-of-file-nam ... -in-excel/

Para VBA veja:
Código: Selecionar todos
Sub AleVBA_4209()
'Fonte: http://stackoverflow.com/questions/10380312/loop-through-files-in-a-folder-using-vba
    Dim MyObj As Object, MySource As Object, file As Variant
   file = Dir("C:\Users\AleVBA\Downloads\")
   While (file <> "")
      If InStr(file, "NomeDoArquivo") > 0 Then
         MsgBox "Foi encontrado " & file
         Exit Sub
      End If
     file = Dir
  Wend
End Sub
Att
Já tinha tentado esse método no meu PC, mas não estava a conseguir. tentei hoje no PC da empresa e funcionou correctamente.
Resolvido. Many thanks :D
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]

Estamos migrando para uma comunidade no Discord