Creating Multiple Workbooks from One Workbook VBA

2019-07-27 06:31发布

I am new to this site and this is my first question, so if I didn't set this up correctly please excuse me. Here is some background info.

We purchased a digital book with relevant company information. It came as a unformulated excel workbook which was great. This workbook has all the particulars of our current, former, and future customers. We are converting from paper to a computerized file system. Management is bent on using Excel as our Workhorse. Everyone here doesn't know how to use computers very well. So in my simplest solution I'm exporting the company names as their own folder

I solved this using,

Sub MakeFolders()
Dim xdir As String
Dim fso
Dim lstrow As Long
Dim i As Long
Set fso = CreateObject("Scripting.FileSystemObject")
lstrow = ActiveSheet.Cells(ActiveSheet.Rows.Count, "A").End(xlUp).Row
Application.ScreenUpdating = False
For i = 1 To lstrow
    'change the path on the next line where you want to create the folders
    xdir = "E:\theFILES\" & Range("A" & i).Value
    If Not fso.FolderExists(xdir) Then
        fso.CreateFolder (xdir)
    End If
Next
Application.ScreenUpdating = True
End Sub

*disclaimer: I found this code either on this site or another equivalent, I don't remember.

Next, I created another workbook (Company Overview Workbook) as a layout for the information from this purchased digital book (workbook) to be inputted in. There are over 5k customers and I am not going to copy and paste 20+ cells for every new workbook for each newly created folder.

This company overview workbook is needed as we have been doing business for over 40yrs and our information will have to be logged, as time progresses. Each of these newly made Company Overview Workbooks will be a log of notes.

The Question: How can I write a VBA to go row by row selecting relevant information, inputting into the Overview Workbook (each piece of info needs to be in designated cells), Save As the Company Name.xlsm; within the corresponding folder. Then move on to the next row and repeat

Ideally, I would like to have this Overview workbook somehow linked to a master where if management needs more (or less) information I can update the formatting quick and clean. At this point, this is not that big of a deal although it will help me solve other problems down the road

I have been searching for someone else Who's solved or asked this question with no success. Any help will be much appreciated!

0条回答
登录 后发表回答