[HELP]Adding new rows with formula

vinchiecent

New Member
Joined
Jan 23, 2014
Messages
3
Hi, I'm new in using macro programming, I just want to know if it is possible to add the cell which is in formula to another sheets, I successfully pasting the Total Amount to other sheets, but my problem is that how if I add a new row to add another amount without copying from the stuck cell let's say i copied row E24 which the total amount is 2000 and when I inserted a new row, 2000 goes down to E25 and I added an amount of 3000 to E24 so the total must be 5000 but in other sheets it still copied to E24 which is 3000.

This is my macro programmed.

Sub addLogs()
Range("E23").Select
Selection.Copy
Sheets("Logs").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Logs").Select
Range("C3").Select
Application.CutCopyMode = False
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
End Sub

Thanks in advance
 

Some videos you may like

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

farmerscott

Well-known Member
Joined
Jan 26, 2013
Messages
813
Office Version
  1. 365
Platform
  1. Windows
Welcome to the forum....

I am not quite sure what you want... can you provide a layout of the data you have and what it should look like.

thx

FarmerScott
 

farmerscott

Well-known Member
Joined
Jan 26, 2013
Messages
813
Office Version
  1. 365
Platform
  1. Windows
So is it only the Total that you are having trouble with?

Will the $$$ amount be the last cell in column D (ie nothing underneath it)?

When you pull the info from your sheet do you want to start a new line for each invoice???
 

vinchiecent

New Member
Joined
Jan 23, 2014
Messages
3
Yes that is the only problem, in the first input the Total amount is copied from the other sheet but if I'm going to insert a new line from Sheet A, and run a macro, Sheet B copy the cell where the line is inserted just like from the image.

Btw, I am making logs for that activity. I wish it would be solved. :(
 

farmerscott

Well-known Member
Joined
Jan 26, 2013
Messages
813
Office Version
  1. 365
Platform
  1. Windows
This will copy the last row in sheet 1 Col C to the last row of sheet 2 Col D. Just change the sheet names and the columns to suit.

Code:
Sub copy_and_paste()
Dim lastrow As Integer

lr = Worksheets("Sheet1").Cells(Rows.Count, "C").End(xlUp).Row
lr2 = Worksheets("Sheet2").Cells(Rows.Count, "D").End(xlUp).Row

Worksheets("Sheet1").Range("C" & lr).Copy Destination:=Sheets("Sheet2").Range("D" & lr2)
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,123,125
Messages
5,599,843
Members
414,342
Latest member
K Darrell Smith

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
Top