ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   need some editing of a template macro. (https://www.excelbanter.com/excel-programming/350552-need-some-editing-template-macro.html)

josh

need some editing of a template macro.
 
this is a macro that takes information from a data sheet and copies it
onto a new sheet using the template for each column of data. atleast
thats what im trying to do. if someone could help me to edit this, i
would greatly appreciate it. thanks.

also, i'd like for each new sheet made to have the name from cell A1
(or the first row in the corrisponding column on the data sheet, ex:
data!b1, data!c1, etc.)

Sub TEMPLATE()
'
' TEMPLATE Macro
' MAKES NEW SHEETS FOR DATA USING TEMPLATE
'
For c = 1 To Lastcol

'
Sheets.Add
ActiveCell.Range("A1").FormulaR1C1 = "=Data!1, & c &"
ActiveCell.Range("A2").FormulaR1C1 = "=Data!2, & c &"
ActiveCell.Range("A3").FormulaR1C1 = "=CONCATENATE(Data!3, & c &,
"" "", Data!4, & c &, "", "", Data!5, & c &)"
ActiveCell.Range("A5").FormulaR1C1 = "=Data!7, & c &"
ActiveCell.Range("A7").FormulaR1C1 = "=CONCATENATE(""Acct # "",
Data!9, & c &)"
ActiveCell.Range("A8").FormulaR1C1 = "=Data!10, & c &"
ActiveCell.Range("C8").FormulaR1C1 = "=CONCATENATE(""Smartlease
Plus - "", Data!11, & c &)"
ActiveCell.Range("A10").FormulaR1C1 = "=CONCATENATE(Data!13, & c &,
"" HUMMER "", Data!14, & c &)"
ActiveCell.Range("A12").FormulaR1C1 = "=CONCATENATE(Data!16, & c &,
"" Month Term"")"
ActiveCell.Range("A13").FormulaR1C1 = "Start Date"
ActiveCell.Range("A14").FormulaR1C1 = "End Date"
ActiveCell.Range("B13").FormulaR1C1 = "=Data!17, & c &"
ActiveCell.Range("B14").FormulaR1C1 = "=Data!18, & c &"
ActiveCell.Range("A16").FormulaR1C1 = "=Data!20, & c &"
ActiveCell.Range("A18").FormulaR1C1 = "=CONCATENATE(""VIN # "",
Data!22, & c &)"
Range("A1:C18").Select
With Selection.Font
.Name = "Times New Roman"
.Size = 18
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Range("A1").Select
Selection.Font.Underline = xlUnderlineStyleSingle
Range("A7").Select
Selection.Font.Bold = True
Columns("A:A").ColumnWidth = 14.29
Rows("1:18").Select
Range("A18").Activate
Selection.Rows.AutoFit

Next c

Exit Sub
MsgBox "done"

End Sub



All times are GMT +1. The time now is 04:20 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com