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?
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?