0

I am trying to fetch information from multiple sheets using FOR loop in excel VBA.

StrFile = "C:\Users\ABC\INT_Data_" & i & ".xlsx" - This code is working and iterating the sheets.

But when i am using StrFile = "C:\Users\ABC\INT_Data_" & i & "*.xlsx" and renaming the sheets accordingly, it is not working throwing error

File Not Found.

ex: INT_Data_1_*.xlsx should give O/P something like INT_Data_1_NewFileName.xlsx but I don't get it.

Pᴇʜ
  • 56,719
  • 10
  • 49
  • 73
VandnaR
  • 1
  • 2

1 Answers1

0

Filenames passed as strings don't take wildcard chars like *. use Dir() instead. Take a look at this answer

horst
  • 781
  • 1
  • 6
  • 14