Creating a new, unique row...

Lonestryder

New Member
Joined
Oct 4, 2006
Messages
3
Hey, everyone. I've created a maco that copies data from a number of cells on one worksheet, and pastes (paste special since the data is dynamically retrieved from a table with vlookup based on a single user entry) them, into another. I've named the button "Save Data" so the user knows their data is being stored (and I need it later for some calculations). I also have a macro button labeled "Clear Data" that clears their data entry, allowing for a clean start on another selection.

My problem is that the data, which I want saved in a single row per "save" is being overwritten with each click of the "save data" macro. I've tried numerous things, such as the following, but the data seems to continue to overwrite in the same row.

Here's a small piece of the code I'm useing (the rest is basically the same with a variation in the cell selected for copying):

Sub CD()
'
' CD Macro
' Macro recorded 10/5/2006 by Kerry McKenzie, PMP
'

'
Selection.Copy
Sheets("tabulation").Select
Range("A1").Select
Selection.End(xlDown).Select
Range("A5").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("avgsalaries").Select
Range("M4").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("tabulation").Select
Range("B1").Select
Selection.End(xlDown).Select
Range("B5").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

____________________________________
And so on. I was under the impression that Selection.End(xlDown).Select would do the trick, but it's still writing over the last entry.

Any thoughts on this?
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

acw

MrExcel MVP
Joined
Feb 13, 2004
Messages
4,814
Hi

The selection(xldown).select moves to the last row OK, but the next line (range("A5").select) takes you back to the same place.

Keeping the existing code, change the
range("A5").select to
activecell.offset(1,0).select

Do the same thing for the B5 entry...

HTH

Tony
 

Forum statistics

Threads
1,136,420
Messages
5,675,742
Members
419,585
Latest member
popsin

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