Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

tricky copy and special paste data

Posted on 2014-01-13
7
Medium Priority
?
296 Views
Last Modified: 2014-01-13
Hi Expert's excel 2007

I need a macro that will copy data from worksheet pivot...based on the data in column a I.e copy all the data above the txt Grand Total and paste into new workbook and save workbook to file path \\gpobal.yftuu\hfghj\ da
te & .xlsx file...

starting range is always A6:hx where is depend on column a and one less grand total txt..
0
Comment
Question by:route217
  • 4
  • 3
7 Comments
 
LVL 34

Expert Comment

by:Rob Henson
ID: 39776398
Is there anything else on the Pivot sheet?

If not you can just do a Worksheet Copy and then break the links or copy and paste all with values.

If that is what you want, let us know and I will sort the macro for you.

Thanks
Rob
0
 

Author Comment

by:route217
ID: 39776411
Nothing else in pivot....

I do not trust the end users...I would kindly like the macro please
0
 
LVL 34

Expert Comment

by:Rob Henson
ID: 39776415
OK, couple of questions then:

1) Name of sheet containing Pivot
2) Path & Filename required for Saved file
3) Do you want to get rid of Rows 1 to 5 above copied pivot and row containing Grand Total

Thanks
Rob H
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:route217
ID: 39776461
1. Pivot - confirmed
2. \\global.test\heujejek\   ps I can amend...
3. Yes and yes in the new pasted workbook and paste into sheet 1 also re name sheet 1 as confirmed numbers and delete sheets 2 and 3.
0
 
LVL 34

Accepted Solution

by:
Rob Henson earned 2000 total points
ID: 39776511
Here's something to get you started, let me know if need any changes.

Sub CopySheet()
    
    Sheets("Pivot").Select
    Sheets("Pivot").Copy
    Cells.Select
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Application.CutCopyMode = False
    Rows("1:5").Select
    Selection.Delete Shift:=xlUp
    Range("A1").Select
    Cells.Find(What:="Grand Total", After:=ActiveCell, LookIn:=xlFormulas, _
        LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
        MatchCase:=False, SearchFormat:=False).Activate
    Selection.EntireRow.Delete
    Sheets("Pivot").Select
    Sheets("Pivot").Name = "Confirmed"
    FilePath = "\\global.test\heujejek\"
    NewFileName = "Pivot Copy 140113.xlsx"
    ActiveWorkbook.SaveAs Filename:=FilePath & NewFileName, FileFormat:= _
        xlOpenXMLWorkbook, CreateBackup:=False
    ActiveWindow.Close

End Sub

Open in new window

I guess you will need some dynamic way of changing the filename. What naming convention will you need?

Thanks
Rob H
0
 

Author Comment

by:route217
ID: 39776556
Thanks Rob H ...let me test kindly.
0
 
LVL 34

Expert Comment

by:Rob Henson
ID: 39776590
Take your time, I will be online until 17:00 GMT.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question