Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

tricky copy and special paste data

Posted on 2014-01-13
7
270 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 33

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 33

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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

 

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 33

Accepted Solution

by:
Rob Henson earned 500 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 33

Expert Comment

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

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

860 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