ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to copy and paste (https://www.excelbanter.com/excel-programming/410951-macro-copy-paste.html)

taylor

Macro to copy and paste
 
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?

Don Guillett

Macro to copy and paste
 
dlr=cells(rows.count,"c").end(xlup).row +1
range("a1:a3").copy cells(dlr,"c")

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Taylor" wrote in message
...
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?



RadarEye

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

taylor

Macro to copy and paste
 
You are exactly right, friend! Thank you so much for your help--it works
like a charm!

"RadarEye" wrote:

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



All times are GMT +1. The time now is 11:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com