VBA-Copy&Paste Ranges Across Sheets

Improv_Eng

New Member
Joined
Nov 3, 2021
Messages
1
Office Version
  1. 365
Platform
  1. 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.


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
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Forum statistics

Threads
1,214,938
Messages
6,122,346
Members
449,080
Latest member
Armadillos

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top