View Single Post
 
Old 03-07-2019, 08:39 AM
Jelmer Jelmer is offline Windows Vista Office 2016
Novice
 
Join Date: May 2017
Location: Netherlands/UK
Posts: 15
Jelmer is on a distinguished road
Default Create new workbooks from template based on sheet with data

I have been searching the web and I found several answers in the right direction but since I'm not a master in VBA I was not able to figure it out.
I have an Excel sheet with data which is an export of a library in SharePoint. I need to be able to filter this data and make changes where required and then use the visible data to create new workbooks based on a template called 'CRS Template' and save them as .xlsx. This needs to be done for each visible row with data.
My idea is to have a workbook called 'CRS Data Input' with on sheet 'Create CRSs' a button to activate the VBA code so I can make the required changes in the second sheet (let's call it 'Data') where I will copy and paste the data from the export from SharePoint.
Then, what the code needs to do for each row is as follows:
  • create new workbook from 'CRS Template'
  • copy data from column B in 'Data' to cell K1 in this new workbook (this is a hyperlink to a file in SharePoint and should still work)
  • copy data from column F in 'Data' to cell N1 in this new workbook
  • copy data from column E in 'Data' to cell K2 in this new workbook
  • copy data from column I in 'Data' to cell K3 in this new workbook
  • save the new workbook as .xlsx with as filename the value in cell K1 with '-CRS' attached to it. So if K1 has 'test' in it, the filename with extension would be test-CRS.xlsx. I would like to save these workbooks in a folder 1 level below the folder in which the 'CRS Data Input' is stored (so using ThisWorkbook.Path & ..\ I guess?)
I think what I want is possible but I just can't figure it out how to do it exactly...

Any help would be very much appreciated!
Reply With Quote