Improv_Eng
New Member
- Joined
- Nov 3, 2021
- Messages
- 1
- Office Version
- 365
- Platform
- Windows
Hi,
I'm not well versed in macros/vba, I'm working in a workbook with multiple sheets. In one sheet called "STEA", I have a button tied to a code that inserts a new row. The user will populate the new row with information. I want the new row and information to be copied and pasted into another worksheet called "Timeline Builder". I would also need the rows to be deleted in "Timeline Builder" sheet if the user chooses to delete rows in "STEA". So, something like a table that functions across worksheets.
As the number of rows the user would add may vary, I need the copy range to be dynamic. I'm not sure how to integrate the copy and paste function into the code.
I would greatly appreciate the help.
I've copied the current working code.
I'm not well versed in macros/vba, I'm working in a workbook with multiple sheets. In one sheet called "STEA", I have a button tied to a code that inserts a new row. The user will populate the new row with information. I want the new row and information to be copied and pasted into another worksheet called "Timeline Builder". I would also need the rows to be deleted in "Timeline Builder" sheet if the user chooses to delete rows in "STEA". So, something like a table that functions across worksheets.
As the number of rows the user would add may vary, I need the copy range to be dynamic. I'm not sure how to integrate the copy and paste function into the code.
I would greatly appreciate the help.
I've copied the current working code.
VBA Code:
Sub Macro2_Activity_AddRow()
'
Application.ScreenUpdating = False
'Inserts New Row
Dim i As Long
Dim Lastrow As Long
Lastrow = Cells(Rows.count, "B").End(xlUp).Row
For i = Lastrow To 1 Step -1
If Cells(i, "B").Value = "8 - Vendors Comparison" Then If i > 1 Then Rows(i - 2).Resize(1).Insert Shift:=xlDown
Next
'Adds Border to Cells
With Range("D" & Lastrow - 34).Borders
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
'Merges New Row Cells
Range(("B" & Lastrow - 34), ("C" & Lastrow - 34)).Merge
'Update Total Time Calculation
Application.ScreenUpdating = True
End With
End Sub