Hi
Can someone give me a simple code to copy all data on sheet1 and paste it to sheet5 using command button
Angela
Hi
Can someone give me a simple code to copy all data on sheet1 and paste it to sheet5 using command button
Angela
![]()
Sub Macro1() Sheets("sheet1").Cells.Copy Sheets("sheet5").Range("A1") End Sub
Hi
I have put this code in but it doesn't work with my command button, am I missing something
error saying expected end sub
Angela
Angela ,
Have you created a command button? Which one did you use? Is it "Form Control" or Active control"?.
You need to attach the code to a button if it the button is created using "Form". If it active control, all you have to do is
change this line
with your active control button![]()
Sub Macro1()
Last edited by AB33; 10-10-2013 at 04:40 AM.
Thanks it works perfectly
Angela
Hi
Can you help me a little more I want to copy a second sheet onto Sheet 2 but when I do that it removes the first sheets data. Is there an extra bit of code to tell it to go to the first free line
Angela
If you are copying in to next empty row in column A
What the code is saying to is: Copy all cells in sheet1 in to the next empty row in column A of sheet 5. You should do the same with the other sheet.![]()
Sub Macro1() Sheets("sheet1").Cells.Copy Sheets("sheet5").Range("A" & Rows.Count).End(xlUp).Offset(1) End Sub
If it is not working, please attach a sample.
Thanks this worked
Angela
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks