copying to next row not working

dstepan

Board Regular
Joined
Apr 16, 2009
Messages
160
Here is my issue.
Line 2 is all set values.
Line 3 is formulas.
I already have a code to copy and paste as a value the last row (ie: Row 3).
I am now trying to copy cells in the range (aa2:ae2) to the next available row (ie: Row 4).

I just can't seem to get it to copy to row 4 and I'm not sure what I am doing wrong.

When I run the code it pastes into row 1 (a:e).

Any direction at all will be helpful.

Code:
Sub Copy_PstasValu_SumDB()

 Dim SrcLastRow As Long
 Dim DestLastRow As Long

 Sheets("summary data Base").Select
 Range("Aa2:aE2").Select
 Selection.Copy
 Range("A" & DestLastRow + 1).Select
 ActiveSheet.Paste
 End Sub[code]


[B]Summary Data Base

[/B]
[TABLE="class: cms_table"]
<tbody>[TR="bgcolor: #CACACA"]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[/TR]
[TR]
[TD="bgcolor: #CACACA, align: center"]1[/TD]
[TD="align: center"]Date[/TD]
[TD="align: center"]Estimate No.[/TD]
[TD="align: center"]Customer[/TD]
[TD="align: center"] Est'd Amt[/TD]
[TD="align: center"]Rep[/TD]
[/TR]
[TR]
[TD="bgcolor: #CACACA, align: center"]2[/TD]
[TD="align: center"]05/01/17[/TD]
[TD="align: center"]6441[/TD]
[TD="align: center"]Data Test[/TD]
[TD="align: center"]             579.25[/TD]
[TD="align: center"]mg[/TD]
[/TR]
[TR]
[TD="bgcolor: #CACACA, align: center"]3[/TD]
[TD="align: center"]05/25/17[/TD]
[TD="align: center"]6442[/TD]
[TD="align: center"]Computer Science & Technology[/TD]
[TD="align: center"]       13,141.11[/TD]
[TD="align: center"]drs[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
It doesn't look like you are setting DestLastRow ... so when you are telling it to select it, it's not selecting anything?

So, maybe something like this?

Rich (BB code):
Sub Copy_PstasValu_SumDB()

 Dim SrcLastRow As Long
 Dim DestLastRow As Long

DestLastRow = Sheets("summary data Base").Range("A2").End(xlUp).Row

 Sheets("summary data Base").Select
 Range("Aa2:aE2").Select
 Selection.Copy
 Range("A" & DestLastRow + 1).Select
 ActiveSheet.Paste
 End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,927
Messages
6,122,311
Members
449,080
Latest member
jmsotelo

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