DavidWaldo
02-15-2017, 01:39 PM
So, during past days I had several questions and recieved much help here. THANKS :). I'm finally getting to the end of my project(automatization of giving contacts to sales reps every morning.) My excel file now downloads SQL data, filters it and spreads it among the sale reps. Each Sale rep has his own sheet. But I dont want them to acces the main file, I'll rather create new excel file for each sale rep. I have sheet names stored in an array, and I would like the new workbooks to have a same name, save the new workbook and close it.
I know it should be something like this
For i = lbound(Wnames) to Ubound(Wnames)
Set NewBook = Workbooks.Add
NewBook.title = wnames(i)
NewBook.saveas = wnames(i) & ".xlxs"
Activeworkbooks.Sheets(Wnames(i)).move workbooks(Wnames(i))next i
but I cant get it working...I'l also would like to implement an safe feature, when one of the sheets doesnt exist - but i do not know how.
Thanks
I know it should be something like this
For i = lbound(Wnames) to Ubound(Wnames)
Set NewBook = Workbooks.Add
NewBook.title = wnames(i)
NewBook.saveas = wnames(i) & ".xlxs"
Activeworkbooks.Sheets(Wnames(i)).move workbooks(Wnames(i))next i
but I cant get it working...I'l also would like to implement an safe feature, when one of the sheets doesnt exist - but i do not know how.
Thanks