I have folder D:\Invoices. There are invoices which are named as Invoice 2000.pdf, Invoice 2001.pdf and so on. How I can get to cell C1 latest invoice number?
I have folder D:\Invoices. There are invoices which are named as Invoice 2000.pdf, Invoice 2001.pdf and so on. How I can get to cell C1 latest invoice number?
Hello,
This may do as you want. Withough knowing the actuall structure of the files stored in the folder and the structure there may be a couple tweeks needed.
The code will strip out numbers from any files held in the folder .pdf .txt it wont descrimnate. meaning that if you store non invoice flies in this folder it can give a false last invoice number. Also i put the result in a public variable if you want to just use it in a single cell update this part of the code to the range in the workbook that you want. eg sheet1.range("A1")
Cheers,![]()
Please Login or Register to view this content.
let me how how it turns out.
Thanks. It starts well but there comes error message:
Run-time error '438':
Object doesn't support this property or method.
"ws.AutoFilter.Sort.SortFields.Clear" row is yellow.
You should be ok to remove that line of code.
Let me know if you have trouble with changing the other parts of the code to suit your needs. If you give me the name of the sheet that you want the result to end up on put that into your next reply.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks