ExcelNooberino
New Member
- Joined
- Jan 2, 2019
- Messages
- 43
- Office Version
- 2016
- Platform
- Windows
Hi guys!
Lately I've been working on some macros and I just created one where I insert the info into some fields and then transpose them onto a different sheet (lets say "History" Sheet). The problem now is I need to do some statistics with that same data but I need to add some formulas on extra columns I created in a different sheet (lets say "Data" Sheet) than the one that receives the data I insert. However, I don't want to go to all that trouble of copying and pasting info between sheets so I need it to transpose to the two sheets at the same time when I press the "Add" macro button. So far I got this:
I've tried to double that code and change the sheet and the row but I keep getting an error..
Lately I've been working on some macros and I just created one where I insert the info into some fields and then transpose them onto a different sheet (lets say "History" Sheet). The problem now is I need to do some statistics with that same data but I need to add some formulas on extra columns I created in a different sheet (lets say "Data" Sheet) than the one that receives the data I insert. However, I don't want to go to all that trouble of copying and pasting info between sheets so I need it to transpose to the two sheets at the same time when I press the "Add" macro button. So far I got this:
Public Sub AddInfo()
Dim y As IntegerDim row As Integer
row = Historico.Cells(Rows.Count, 3).End(xlUp).Offset(1, 0).Row
y = Application.WorksheetFunction.Max(Range("B:B"))
History.Cells(row, 2).Value = y + 1 'ID
History.Cells(row, 3).Value = Range("camp_1").Value
History.Cells(row, 4).Value = Range("camp_2").Value
History.Cells(row, 5).Value = Range("camp_3").Value
History.Cells(row, 6).Value = Range("camp_4").Value
History.Cells(row, 7).Value = Range("camp_5").Value
History.Cells(row, 8).Value = Range("camp_6").Value
History.Cells(row, 9).Value = Range("camp_7").Value
History.Cells(row, 10).Value = Range("camp_8").Value
History.Cells(row, 11).Value = Range("camp_9").Value
History.Cells(row, 12).Value = Range("camp_10").Value
History.Cells(row, 13).Value = Range("camp_11").Value
History.Cells(row, 14).Value = Range("camp_12").Value
MsgBox "Info Successfully added!", vbInformation, "Add Info"
Call CleanFields
End Sub
I've tried to double that code and change the sheet and the row but I keep getting an error..
Last edited: