Insert a new row in two completely different sheets

blaisjoel

New Member
Joined
Oct 28, 2016
Messages
30
Hi, I am trying to add a unit in worksheet (new assets) while having it automatically inserted in the other worksheet (fleet replacement planning) with the unit ID and unit type.


new assets worksheet
unit id
unit type
delivery date
retail cost
lt-16
trailer log
15 dec 16
100000
ct-3
truck tractor
15 dec 16
125000

<tbody>
</tbody>


fleet replacement planning worksheet
unit id
unit type
current hours
rebuilt
trailer log
125
lt-15
trailer log
n
truck tractor
ct-2
truck tractor
1254
n

<tbody>
</tbody>

when lt-16 is added in new assets worksheet, it should also be added to fleet replacement planning worksheet automatically.
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Hi, I am trying to add a unit in worksheet (new assets) while having it automatically inserted in the other worksheet (fleet replacement planning) with the unit ID and unit type.


new assets worksheet
unit idunit typedelivery dateretail cost
lt-16trailer log15 dec 16100000
ct-3truck tractor15 dec 16125000

<tbody>
</tbody>


fleet replacement planning worksheet
unit idunit typecurrent hoursrebuilt
trailer log125
lt-15trailer logn
truck tractor
ct-2truck tractor1254n

<tbody>
</tbody>

when lt-16 is added in new assets worksheet, it should also be added to fleet replacement planning worksheet automatically.

Hie blaisjoel,

Find the Below Code, insert that code in the button once it is done it would give you the change as you want.
Fill all the data, in New asset worksheet and then press the button which would do the process in a blink

Code:
Sub Tranferdata()
Dim LastRow As Long
    With ActiveSheet
    LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
    End With
    Range("A" & LastRow).Select
    Range(ActiveCell, ActiveCell.Offset(0, 1)).Copy
    Workbooks.Open ("Full Path of your Fleet Replacement Planning Worksheet")
    With ActiveSheet
    LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
    Range("A" & LastRow + 2).Select
    ActiveCell.PasteSpecial xlPasteValues
    ActiveCell.Offset(0, 1).Copy
    ActiveCell.Offset(-1, 0).Select
    ActiveCell.PasteSpecial xlPasteValues
    ActiveCell.Offset(2, 0).Select
    ActiveCell.Clear
    ActiveWorkbook.Close savechanges:=True
    End With
End Sub

Regards
CPatel13

A Like and feedback would be appreciated :)
 
Upvote 0
Solution

Forum statistics

Threads
1,214,812
Messages
6,121,704
Members
449,048
Latest member
81jamesacct

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