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

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
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
 
Upvote 0

Forum statistics

Threads
1,214,957
Messages
6,122,472
Members
449,087
Latest member
RExcelSearch

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