Macro to Move Entry to Last Line of a List

T

Tysone

OK here is what I'm trying to do. I want to have an entry line where
I could put things like Date/Name/Description, then hit a button and
have that information I just entered go to the last entry of a list.

Here is an example of what I'm shooting for.
TAB: Data Enter

A2: 11/18/2003 B2: The Pizza Place C2: Pizza dinner for family

HIT MACRO

The data would be transferred to another tab, find the last item and
put it at the end of the list

TAB: Data List (Different tab)
A1 B1 C1
DATE NAME Description
11/15/2003 Fred's Bar Lunch with my brother
11/18/2003 The Pizza Place Pizza for the family


And then the next item would go below that, so on, and so on. I know
how to set up everything, its just the writing the macro I'm having
issues with.

Can anyone help me with this?
 
H

Harald Staff

Hi

See if this works for you. It does not consider different sheets as is:

Sub test()
Dim NextRow As Long
NextRow = Cells(30000, 1).End(xlUp).Row + 1
Cells(NextRow, 1).Value = "Last A cell " & Time
End Sub
 
A

Anders S

Here's something to start with,

'-----
Sub enterData()
Dim sourceRng As Range, destRng As Range
Set sourceRng = Worksheets("Data Enter").Range("A2:C2")
Set destRng = Worksheets("Data").Range("A1").End(xlDown)
Set destRng = destRng.Offset(1, 0).Resize(1, 3)
'sourceRng.Copy destRng 'or
destRng.Value = sourceRng.Value
End Sub
'-----

HTH
Anders Silvén
 
G

Guest

Here's another way:
Dim lastrow As Integer

Sub MoveToList()
Range("A2:C2").Select
Selection.Copy
Sheets("Data List").Select
'find lastrow
If WorksheetFunction.CountA(Cells) > 0 Then
lastrow = Cells.Find(What:="*", After:=[a1],
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row
End If
Range("A" & lastrow + 1).Select
ActiveSheet.Paste
Sheets("data entry").Select
End Sub
 
G

Gord Dibben

Ty

Sub copytolist()
Sheets("Data Enter").Activate
Range("A2:C2").Copy Destination:=Sheets("Data List") _
.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
End Sub

Gord Dibben XL2002
 
T

Tysone

One more Q arose on this.

In this, is there a way to make it, COPY, paste special values too?


Sub copytolist()
Sheets("Data Enter").Activate
Range("A2:C2").Copy Destination:=Sheets("Data List") _
.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
End Sub




Thanks

Tyson
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top