Copy Paste Delete Macro ?

sqex

New Member
Joined
Nov 22, 2005
Messages
19
HI Guys.

Im look for a way that when a button is clicked withing excel it will copy all data from certain cells to another sheet.

eg


A1 A2 A3

Data 1 Date Button - that copies


Sheet 2


A1 A2 A3

Data 1 copy Date copy Completed


I then need it to delete the orginal entry and just leave the word completed

IF anyone could help me out on this one i would be very very greatfull

Regards

sqex
 

Some videos you may like

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

HalfAce

MrExcel MVP
Joined
Apr 6, 2003
Messages
9,453
Hello sqex,
I'm not sure if this is what you're after, but perhaps it'll help get you started.
Code:
Sub Demo()
With Sheets("Sheet2")
    .[A1] = Sheets("Sheet1").[A1].Value & " Copy"
    .[A2] = Sheets("Sheet1").[A2].Value & " Copy"
    .[A3] = "Completed"
End With
With Sheets("Sheet1")
    .[A1] = "Completed"
    .[A2:A3].ClearContents
End With
End Sub
Hope it helps. Let us know if it doesn't.
 

sqex

New Member
Joined
Nov 22, 2005
Messages
19
Hi, not quite.

i need e.g

e11 , e12 , e13 to be copied to other cells on sheet 2 e.g e11 , e12, e13, when a button at the end of the row is pressed

the oringinal data is then deleted leaving only the new copied version.
 

HalfAce

MrExcel MVP
Joined
Apr 6, 2003
Messages
9,453

ADVERTISEMENT

You mean just this?
Code:
Sub Demo()
With Sheets("Sheet1").[E11:E13]
    .Copy Sheets("Sheet2").[E11]
    .ClearContents
End With
End Sub
 

sqex

New Member
Joined
Nov 22, 2005
Messages
19
Hi , thanks i tried to apply that to my sheet but just comes up with errors

As Simple as i can put it is this

Copy Data from e11 , e13 from "Monday"

Paste Data to e11 , e13 "Application History"

Delete Data from e11 , e13 on the "Monday" Sheet

Stop macro, assign macro to button. click button and the above works
 

HalfAce

MrExcel MVP
Joined
Apr 6, 2003
Messages
9,453

ADVERTISEMENT

Does that mean you're up and running now that you've recorded what you want to do?

It appears the reason you got errors (though you didn't mention what the errors were) with my code is because it's written to perform on sheets named "Sheet1" & "Sheet2"

If you want it to work on your sheets, you'd need to amend the code (and any other generic code examples you'll see) to specify your sheet names. (ie.)
Code:
 Sub Demo()
With Sheets("Monday").[E11:E13]
    .Copy Sheets("Application History").[E11]
    .ClearContents
End With
End Sub
Does that help at all?
 

sqex

New Member
Joined
Nov 22, 2005
Messages
19
when i use the code in that format, it just freezes up the application

i just cant seem to figure out why it wont take the data from the cells and paste it to another sheet without giving me erros the macro should work but just ends in an error and says debug Run time error 9 any help on this would be most greatful
 

HalfAce

MrExcel MVP
Joined
Apr 6, 2003
Messages
9,453
When you get the error and press Debug, which line of code is highlighted yellow?
 

Watch MrExcel Video

Forum statistics

Threads
1,118,760
Messages
5,574,084
Members
412,566
Latest member
TexasTony
Top