View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
RadarEye RadarEye is offline
external usenet poster
 
Posts: 78
Default Macro to copy and paste

On 14 mei, 17:56, Taylor wrote:
I need a macro that will copy information from a specific range of cells
(A1:A3, for example) and paste that information into a selected range of
cells. *Here's the catch: *after new info is input and copied, I would like
for it to be pasted in the range of cells directly below whatever info was
previously copied and pasted without deleting the info previously copied and
pasted. *

For example:
Type Name Address Phone Number in Cells A1, A2, A3, respectively. *Run macro
to copy information from A1:A3 and paste it in B1:B3. *Return to Cell A1 and
type Taylor, 123 4th St, 999-9999 in cells A1, A2, A3, respectively. *Run
same macro as above with command that will paste this new information in
cells C1:C3 (directly below previously entered info). *I hope this makes
sense?


Hi Taylor,

I think tou have your Columns and Rows mixed up a bit.
If you use the columns across there is only room for 255 names.

If you use the rows there is room for at least 16000 names, acording
to the version of excel you are using.
This might help:

Sub CopyToFirstEmptyRow()

Range("A1:C1").Copy

If IsEmpty(Range("A2")) Then
Range("A2").Select
Else
If IsEmpty(Range("A3")) Then
Range("A3").Select
Else
Range("A2").End(xlDown).Offset(1, 0).Select
End If
End If
ActiveSheet.Paste
Range("A1:C1").ClearContents

' Start Bonuspart
Range(Cells(2, 1), Cells(ActiveCell.Row, 3)).Select
Selection.Sort Key1:=Range("A2"), Order1:=xlAscending, _
Header:=xlGuess, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortTextAsNumbers
' End Bonuspart
Range("A1").Select
End Sub


HTH,
RadarEye