Excel 2007 - VBA Help. Copy Rows between Tabs

OK.  Checkboxes didn't work as it just crashes my Excel.  So trying again.  So here is what I need.

Have a spreadsheet (Attached).  This is only two tabs of the actual spreadsheet but hoping this can convert easily.  Tabs are Retrieval and Master.  Rows 1-15 are heading rows and should never be altered or moved or changed in any way.

Also why it asks for vba password is beyond me.  This is a brand new Excel sheet from scratch.  I never set a password.

If possible can we name modules something related to these buttons/macros?  

I really appreciate the help.  I tried the 'Check Box' way via another post and it just crashed my Excel as the file grew too big.  

I put notes on each tab in the file for details.  I will award a ton of points for this on separate questions as we go down each.
Who is Participating?
NorieConnect With a Mentor VBA ExpertCommented:
Here's an update version that removes the existing data in the Master sheet.

As for the other buttons/questions, I suppose it's up to you - not sure if there any rules/etiquette.
@elwayisgod :

There are 2 different kinds of buttons in Excel:
1) "ActiveX"-Buttons and
2) "Form"-Buttons

Because the three buttons in your Excel file were "Form-Buttons", I inserted three
"ActiveX-Buttons", and if you insert some code, your code should work. See attached file ...
elwayisgodAuthor Commented:
OK.. I have no idea what Active X means.  I need help with the code to perform the tasks too.  I'm not a VBA person at all.  I can attach the code to a button and do some minor tinkering but cannot actually write the code too.

I can't even get into the Visual Basic editor?  It asks for a password.  I never even set one.
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

>>I can't even get into the Visual Basic editor?
When Excel is running press [ALT + F11]. Then you can insert your VBA code.

>>It asks for a password.
On my computer it doesn't ask for a password, and I can insert some code.
NorieVBA ExpertCommented:
This code will copy the records from Retrieval as indicated, it uses Sheet3 as a kind of 'workings' sheet.
Option Explicit

Sub CopyFromRetrieval()
Dim rngData As Range
Dim rngResult As Range
Dim rngHeaders As Range
Dim NoCols As Long
Dim rngDst As Range
Dim rngCrit As Range
Dim LastRow As Long

    LastRow = Worksheets("Retrieval").Range("B" & Rows.Count).End(xlUp).Row

    Set rngData = Worksheets("Retrieval").Range("A14:U1" & LastRow)
    Set rngHeaders = rngData.Rows(1)
    NoCols = rngData.Columns.Count
    rngHeaders.Cells(1, 1).Value = "Field1"
    rngData.Cells(1, 1).AutoFill rngHeaders.Rows(1), xlFillDefault
    Set rngCrit = Worksheets("Sheet3").Range("A1:A2")
    rngCrit.Value = Application.Transpose(Array("Field1", "Copy"))
    Set rngDst = Worksheets("Master").Range("B" & Rows.Count).End(xlUp).Offset(1, -1)
    rngData.AdvancedFilter xlFilterCopy, rngCrit, rngCrit.Cells(1, 1).Offset(, 2), True
    rngCrit.Resize(, 2).EntireColumn.Delete
    LastRow = Worksheets("Sheet3").Range("A" & Rows.Count).End(xlUp).Row
    Set rngResult = Worksheets("Sheet3").Range("A2:U" & LastRow)
    rngDst.PasteSpecial xlPasteValues
    Application.CutCopyMode = False
End Sub

Open in new window

If you right click one of the buttons, select Assign Macro.. you can assign this sub to the button's click event.

I've done that with the Copy to Master tab button in the file attached.

Not sure what the other 2 buttons are meant to do.
elwayisgodAuthor Commented:
This looks pretty good on the copy.  A few things.  Can it clear the 'Master' tab first?  That way everytime they hit the button, it's a fresh set of rows over there? Thats all I can think of on this button.  After we fix this can we move to the other buttons?
elwayisgodAuthor Commented:
I need a drop down box in Column A for Rows 15 to 3014.  Choices are 'Copy' and NULL or Blank.  That way only the ones with 'Copy' get copied when the button is pressed.

Also when I set one as Copy can it apply the shading like in the example?  There's potentially thousands of rows and shading the 'Copy' ones will help?

I can post new questions if you want more points.
elwayisgodAuthor Commented:
Excellent.  I'll post new question and will award another 500 pts.  You willing to keep helping me.  Only a few more to do.
elwayisgodAuthor Commented:
elwayisgodAuthor Commented:
New question is posted.  I appreciate help
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.