Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to copy and paste values (columns)I have a macro file built | Excel Programming | |||
copy multiple worksheets of a workbook, and paste onto a Word document ( either create new doc file or paste onto an existing file.) I need this done by VBA, Excel Macro | Excel Programming | |||
Copy and Paste macro needs to paste to a changing cell reference | Excel Programming | |||
how to count/sum by function/macro to get the number of record to do copy/paste in macro | Excel Programming | |||
Macro to Copy/Paste then Paste to Next Line | Excel Programming |