Basic copy and paste macro

jjlang22

New Member
Joined
Nov 25, 2009
Messages
9
Hi, hopefully someone can help.

I have a 2 sheet spreadsheet.

The first sheet is an input sheet, with cells A2-5 all required entry fields.

The next sheet is a replica, but will hold all entries.

How do i write a macro which copys the data from sheet 1 into the next availabe blank row in sheet 2?
I have no experience of macro writing so would like to know all the steps from please.

Thanks
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
i made a mistake in my first post.

The input sheet has cells A1-E1 which need populated and the 2nd sheet replicates these
 
Upvote 0
Hello and welcome to MrExcel.

Press ALT + F11 to open the Visual Basic Editor, select Module from the Insert Menu and paste into the white space on the right.

Code:
Sub Cpy()
Sheets("Sheet1").Range("A1:E1").Copy Destination:=Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1)
End Sub
Press ALT + Q to close the code window, Tools > Macro > Macros, click on Cpy then click the Run button.
 
Upvote 0
Hi VoG

Thanks for the reply, that's ideal.

Now I just need to work out how to delete the input sheet so it's blank for the next user, and I'm ready to go.
 
Upvote 0
That should be straightforward:

Rich (BB code):
Sub Cpy()
Sheets("Sheet1").Range("A1:E1").Cut Destination:=Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1)
End Sub
 
Upvote 0
Thanks for all your help on this.

One last question hopefully.

How do i change the code so I paste values?

I want to include a concatenate function in the input sheet but want the macro to copy and paste as a value in the 2nd sheet.

Thanks
 
Upvote 0
Try

Code:
Sub Cpy()
With Sheets("Sheet1").Range("A1:E1")
    .Copy
    Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues
    .ClearContents
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,426
Messages
6,119,411
Members
448,894
Latest member
spenstar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top