PDA

View Full Version : Macro HELP PLEASE



DAWG2006
06-23-2009, 11:08 AM
http://www.mrexcel.com/forum/showthread.php?t=398252



Hi Experts at VBAExpress. I have 10 buttons that all work the same way. When you press the button it copies the name that is in Sheet1 cells V3:Y3 (Button #1), V4:Y4 (Button #2), etc. and special pastes them into Sheet6. At the same time it goes into Sheet5 and deletes the the row that is mirrored in Sheet1.
I have now expanded my Sheet5 and it has a lot of repeat names but in sperate rows. What I am looking to do is have the macro continue copy and paste the cells on Sheet1 but also have them delete all the "same" names located on Sheet5. What do I need to do to accomplish this?

Simon Lloyd
06-23-2009, 11:18 AM
http://www.mrexcel.com/forum/showthread.php?t=398252Nice of you to post the link to the cross post, but i am sure i speak for everyone else here when i say i'll be buggered if i am going to visit another forum to read a thread that you want answering and then provide the solution here.....come on, you have to do a bit of work yourself!

DAWG2006
06-23-2009, 11:32 AM
The last time I posted to this thread and someone had a similar thread to me on MrExcel I got yelled at for not post the cite. So I did this time and NOW I'm getting slapped on the wrist again. COME ON NOW. I need help with a project and I came to this cite for help. But if you're to lazy to help me then I guess I will go to where someone is more willing to actually do some work.

rbrhodes
06-23-2009, 12:31 PM
Hi DAWG,

Posting the xlink is excellent. However I think what Simon means is that you should have also posted the question here (as well as the xlink). That way VBAExpress becomes searchable for the problem and the solution.

Simon Lloyd
06-23-2009, 01:05 PM
Hi DAWG,

Posting the xlink is excellent. However I think what Simon means is that you should have also posted the question here (as well as the xlink). That way VBAExpress becomes searchable for the problem and the solution.rbrhodes, yo're right but to look at his post here there was no question to answer, simply a link, so i wonder who was actually being lazy? :)

Simon Lloyd
06-23-2009, 01:33 PM
Ok so i checked the code, it doesn't explain much nor seem to work as the OP states or expects, anyway here its is if dawg wants to give us more information, i've annotated it a little:
Sub Add1()
'works on the activesheet
Range("V3:Y3").Select
Selection.Copy
'negates copy
Application.CutCopyMode = False
Sheets("Sheet6").Select
Range("B2").Select
'negates selecting sheets 6
Sheets("Sheet1").Select
'only copies the last selected cell(s) on sheet1
Selection.Copy
Sheets("Sheet6").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Dim NR As Long
NR = Sheets("Sheet6").Range("B" & Rows.Count).End(xlUp).Row + 1
'copies the recently pasted values to the next line down
Sheets("Sheet6").Range("B" & NR).PasteSpecial xlPasteValues
Sheets("Sheet5").Select
'deletes cells not rows located in the range below
Range("B2:E2").Select
Selection.Delete Shift:=xlUp
Sheets("Sheet1").Select
End Sub