Novicesportsperformer
New Member
- Joined
- Nov 21, 2016
- Messages
- 37
Hi All,
Wondering if you could help me out - I am completely brand new to VBA.
I am trying to get specific data to automatically transfer into another worksheet table.
I keep getting a 1004 error on the code
It would be really great if you guys could help me on this one, thanks!
The code is as follows:
Sub add_to_database()
Dim DR As Long 'DR stands for database row - the in the DB where the program will be pasted into
Dim Database As Worksheet
Dim Template As Worksheet
Dim Proname As String
Set Database = Sheet6
Set Template = ActiveSheet
Proname = InputBox("Name this program")
'find the first blank row of the database - DR stands for database row
Database.Select
DR = Cells(Rows.Count, 1).End(x1Up).Offsett(1, 0).Row (where it says the error is)
Database.Cells(DR, 1) = Proname
Database.Cells(DR, 2) = Template.Cells(21, 2).Value 'Category 1
Database.Cells(DR, 3) = Template.Cells(27, 2).Value
Database.Cells(DR, 4) = Template.Cells(33, 2).Value
Database.Cells(DR, 5) = Template.Cells(39, 2).Value
Database.Cells(DR, 6) = Template.Cells(45, 2).Value
Database.Cells(DR, 7) = Template.Cells(51, 2).Value
Database.Cells(DR, 8) = Template.Cells(57, 2).Value
Database.Cells(DR, 9) = Template.Cells(63, 2).Value
Database.Cells(DR, 10) = Template.Cells(23, 2).Value 'SetReps 1
Database.Cells(DR, 11) = Template.Cells(29, 2).Value
Database.Cells(DR, 12) = Template.Cells(35, 2).Value
Database.Cells(DR, 13) = Template.Cells(41, 2).Value
Database.Cells(DR, 14) = Template.Cells(47, 2).Value
Database.Cells(DR, 15) = Template.Cells(53, 2).Value
Database.Cells(DR, 16) = Template.Cells(59, 2).Value
Database.Cells(DR, 17) = Template.Cells(65, 2).Value
Database.Cells(DR, 18) = Template.Cells(21, 2).Value 'Exercise 1
Database.Cells(DR, 19) = Template.Cells(27, 2).Value
Database.Cells(DR, 20) = Template.Cells(33, 2).Value
Database.Cells(DR, 21) = Template.Cells(39, 2).Value
Database.Cells(DR, 22) = Template.Cells(45, 2).Value
Database.Cells(DR, 23) = Template.Cells(51, 2).Value
Database.Cells(DR, 24) = Template.Cells(57, 2).Value
Database.Cells(DR, 25) = Template.Cells(63, 2).Value
Wondering if you could help me out - I am completely brand new to VBA.
I am trying to get specific data to automatically transfer into another worksheet table.
I keep getting a 1004 error on the code
It would be really great if you guys could help me on this one, thanks!
The code is as follows:
Sub add_to_database()
Dim DR As Long 'DR stands for database row - the in the DB where the program will be pasted into
Dim Database As Worksheet
Dim Template As Worksheet
Dim Proname As String
Set Database = Sheet6
Set Template = ActiveSheet
Proname = InputBox("Name this program")
'find the first blank row of the database - DR stands for database row
Database.Select
DR = Cells(Rows.Count, 1).End(x1Up).Offsett(1, 0).Row (where it says the error is)
Database.Cells(DR, 1) = Proname
Database.Cells(DR, 2) = Template.Cells(21, 2).Value 'Category 1
Database.Cells(DR, 3) = Template.Cells(27, 2).Value
Database.Cells(DR, 4) = Template.Cells(33, 2).Value
Database.Cells(DR, 5) = Template.Cells(39, 2).Value
Database.Cells(DR, 6) = Template.Cells(45, 2).Value
Database.Cells(DR, 7) = Template.Cells(51, 2).Value
Database.Cells(DR, 8) = Template.Cells(57, 2).Value
Database.Cells(DR, 9) = Template.Cells(63, 2).Value
Database.Cells(DR, 10) = Template.Cells(23, 2).Value 'SetReps 1
Database.Cells(DR, 11) = Template.Cells(29, 2).Value
Database.Cells(DR, 12) = Template.Cells(35, 2).Value
Database.Cells(DR, 13) = Template.Cells(41, 2).Value
Database.Cells(DR, 14) = Template.Cells(47, 2).Value
Database.Cells(DR, 15) = Template.Cells(53, 2).Value
Database.Cells(DR, 16) = Template.Cells(59, 2).Value
Database.Cells(DR, 17) = Template.Cells(65, 2).Value
Database.Cells(DR, 18) = Template.Cells(21, 2).Value 'Exercise 1
Database.Cells(DR, 19) = Template.Cells(27, 2).Value
Database.Cells(DR, 20) = Template.Cells(33, 2).Value
Database.Cells(DR, 21) = Template.Cells(39, 2).Value
Database.Cells(DR, 22) = Template.Cells(45, 2).Value
Database.Cells(DR, 23) = Template.Cells(51, 2).Value
Database.Cells(DR, 24) = Template.Cells(57, 2).Value
Database.Cells(DR, 25) = Template.Cells(63, 2).Value