Hello,
I tried recording a macro to automatically equate cells from a newly created workbook (also part of the macro) to another workbook to create a sort of a database.
So "template 5 was created, and I manually made the cells on the "database" worksheet, equal to those some on template 3.
Here is the code from that recording.
Sub Populatedata()
'
' Populatedata Macro
'
' Keyboard Shortcut: Ctrl+r
'
Sheets("Template").Select
Sheets("Template").Copy After:=Sheets(6)
Sheets("Database").Select
ActiveCell.Offset(-6, -2).Range("A1").Select
ActiveCell.FormulaR1C1 = "='Template (5)'!R[-1]C[4]"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "='Template (5)'!RC[3]"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "='Template (5)'!R[1]C[2]"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "='Template (5)'!R[6]C"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "='Template (5)'!R[6]C"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "='Template (5)'!R[6]C"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "='Template (5)'!R[8]C[-3]"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "='Template (5)'!R[8]C[-3]"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "='Template (5)'!R[8]C[-3]"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "='Template (5)'!R[10]C[-6]"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "='Template (5)'!R[10]C[-6]"
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveCell.FormulaR1C1 = "='Template (5)'!R[10]C[-6]"
ActiveCell.Offset(1, 0).Range("A1").Select
ActiveWindow.SmallScroll Down:=-3
End Sub
Notice how the code did absolute referencing for template 5. Is there a way to edit this code so that when a new worksheet is created through the macro, those cells from the new worksheet automatically are filled on the "database" worksheet?
I dont know any VBA coding so I am trying to find a way to make this as simpler as possible.
Appreciate any/ all help a lot!
Bookmarks