Create a Master sheet to then transpose and export spreadsheets

loribear180

New Member
Joined
Apr 13, 2021
Messages
29
Office Version
  1. 2016
Platform
  1. Windows
Hello! I just need some guidance into what I'm supposed to actually be learning/googling.

I usually create multiple checklists from an Excel 'template' spreadsheet. However, this is too time consuming and I was hoping I could create a simple Master spreadsheet where I could enter all the data and then have Excel automatically transpose (not sure i'm using the correct term) this info and create all the necessary files using the 'template'.

For example, the template includes name, dob, address, etc. I wanted to be able to enter all of this in the Master spreadsheet and then Excel can automatically enter all of this using the template and create/save the multiple files in a specific folder. HELP, i'm not sure where to begin googling or what thread to search for.

1623160542165.png
1623160562943.png
 
@JackDanIce since you mentioned the Word mail merge, what is the equivalent process in Excel? I'm willing to put in the time to learn it, I just need to know what I'm supposed to be Googling.
 
Upvote 0

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Are they textbox form NO
control or ActiveX control NO
or is it a range name? NO

You have a textbox shape! :LOL:

It is unusual that object for a templeate. But here is the solution:

VBA Code:
Sub Export_Template()
  Dim wb2 As Workbook
  Dim shM As Worksheet, shT As Worksheet, sh2 As Worksheet
  Dim i As Long
  
  Application.ScreenUpdating = False
  Set shM = Sheets("Data")    'Data sheet
  Set shT = Sheets("Rollover Template")  'Rollover Template sheet
  
  For i = 2 To shM.Range("A" & Rows.Count).End(3).Row
    shT.Copy
    Set wb2 = ActiveWorkbook
    Set sh2 = wb2.Sheets(1)
    sh2.Shapes("TextBox 15").TextFrame.Characters.Text = shM.Range("A" & i).Value   'DC or AJ
    sh2.Shapes("TextBox 16").TextFrame.Characters.Text = shM.Range("B" & i).Value  'Last, First Name
    sh2.Shapes("TextBox 17").TextFrame.Characters.Text = shM.Range("C" & i).Value  'Annual Work Period Start
    sh2.Shapes("TextBox 18").TextFrame.Characters.Text = shM.Range("D" & i).Value  'Term
    sh2.Shapes("TextBox 20").TextFrame.Characters.Text = shM.Range("E" & i).Value  '% Effort
    sh2.Shapes("TextBox 19").TextFrame.Characters.Text = shM.Range("F" & i).Value  'Workday Period
    sh2.Range("D5").Value = shM.Range("G" & i).Value  'UIN
    sh2.Range("E7").Value = shM.Range("H" & i).Value  'Position
    sh2.Range("E9").Value = shM.Range("I" & i).Value  'Department
    sh2.Range("E11").Value = shM.Range("J" & i).Value  'Office Location
    sh2.Range("G11").Value = shM.Range("K" & i).Value  'Ext.
    sh2.Range("E13").Value = shM.Range("L" & i).Value  'Supervisor
    sh2.Range("G15").Value = shM.Range("M" & i).Value  'Pay Date
    '
    wb2.SaveAs "C:\Users\lorena.rodriguez\Desktop\TRAINING RESOURCES\ADJUNCT\MACRO TEMPLATES" & shM.Range("A" & i).Value & ".xlsx"
    wb2.Close False
  Next
End Sub

I'm not sure the folder if it is with \ before the filename:
"C:\Users\lorena.rodriguez\Desktop\TRAINING RESOURCES\ADJUNCT\MACRO TEMPLATES\"
 
Upvote 0
You have a textbox shape! :LOL:

It is unusual that object for a templeate. But here is the solution:

VBA Code:
Sub Export_Template()
  Dim wb2 As Workbook
  Dim shM As Worksheet, shT As Worksheet, sh2 As Worksheet
  Dim i As Long
 
  Application.ScreenUpdating = False
  Set shM = Sheets("Data")    'Data sheet
  Set shT = Sheets("Rollover Template")  'Rollover Template sheet
 
  For i = 2 To shM.Range("A" & Rows.Count).End(3).Row
    shT.Copy
    Set wb2 = ActiveWorkbook
    Set sh2 = wb2.Sheets(1)
    sh2.Shapes("TextBox 15").TextFrame.Characters.Text = shM.Range("A" & i).Value   'DC or AJ
    sh2.Shapes("TextBox 16").TextFrame.Characters.Text = shM.Range("B" & i).Value  'Last, First Name
    sh2.Shapes("TextBox 17").TextFrame.Characters.Text = shM.Range("C" & i).Value  'Annual Work Period Start
    sh2.Shapes("TextBox 18").TextFrame.Characters.Text = shM.Range("D" & i).Value  'Term
    sh2.Shapes("TextBox 20").TextFrame.Characters.Text = shM.Range("E" & i).Value  '% Effort
    sh2.Shapes("TextBox 19").TextFrame.Characters.Text = shM.Range("F" & i).Value  'Workday Period
    sh2.Range("D5").Value = shM.Range("G" & i).Value  'UIN
    sh2.Range("E7").Value = shM.Range("H" & i).Value  'Position
    sh2.Range("E9").Value = shM.Range("I" & i).Value  'Department
    sh2.Range("E11").Value = shM.Range("J" & i).Value  'Office Location
    sh2.Range("G11").Value = shM.Range("K" & i).Value  'Ext.
    sh2.Range("E13").Value = shM.Range("L" & i).Value  'Supervisor
    sh2.Range("G15").Value = shM.Range("M" & i).Value  'Pay Date
    '
    wb2.SaveAs "C:\Users\lorena.rodriguez\Desktop\TRAINING RESOURCES\ADJUNCT\MACRO TEMPLATES" & shM.Range("A" & i).Value & ".xlsx"
    wb2.Close False
  Next
End Sub

I'm not sure the folder if it is with \ before the filename:
"C:\Users\lorena.rodriguez\Desktop\TRAINING RESOURCES\ADJUNCT\MACRO TEMPLATES\"
@DanteAmor I must be really dumb or something because it just isn't working for me :cry: does the Dropbox file work? For some reason when I paste the code intot the spreadsheet in my desktop it just gives me error after error.
 
Upvote 0
I paste the code intot the spreadsheet in my desktop it just gives me error after error.

What the error message says. If you press the "Debug" button, which line of the macro is highlighted?

Try with my test file. The new files will be created in the same folder where you have the file with the macro.

The macro is in "Module1"

 
Upvote 0
Could it be my Excel that is creating issues??

I receive the following error:
1623694114359.png


With this line highlighted:
1623694102657.png
 
Upvote 0
It's the name that appears on the file you shared.
Check the name of each Shape-Textbox.
Select the Shape-Textbox and check the name in the name box.

1623694942327.png


That data is what should be put in the line of code:

VBA Code:
sh2.Shapes("TextBox 15").TextFrame.Characters.Text = shM.Range("A" & i).Value   'DC or AJ
 
Upvote 0
I did list each textbox name, they're all just simply titled TextBox 15, TextBox 16, etc. Could it be due to the spaces in the titles?
 
Upvote 0
Spaces don't matter, it works for me.
You also have problems with the file that I shared with you in post #15?
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top