Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7539775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:28:20+00:00 2026-05-30T07:28:20+00:00

I am new to macros.I want to write a macro to copy specific data

  • 0

I am new to macros.I want to write a macro to copy specific data in columns in MPP to another using excel.

I have found a code that will copy data from one excel to another.please help

Option Explicit

Sub CopytoPS()
    Dim sfil As String
    Dim owbk As Workbook
    Dim sPath As String

    sPath = "C:\Users\HYMC\Excel\Test\" 'Change the file path for your purposes
    sfil = Dir(sPath & "Management Report PS.xls")

    Range("A2:I22").Copy

    Set owbk = Workbooks.Open(sPath & sfil)
    owbk.Sheets("Sales Data").Range("B65536").End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
    owbk.Close True 'Save opened workbook and close
    sfil = Dir
End Sub

I want to copy certain coloums in MPP to a set of cloumns in Excel.I also want user to just give the destination file path,source file ,source cells to be copied and destination cells

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T07:28:22+00:00Added an answer on May 30, 2026 at 7:28 am

    To work with MPP file in Excel, Open the VBA Editor and click References on the Tools menu. In the Available References list, click to select the Microsoft Project xx.xx Object Library check box. If the Microsoft Project 9.0 Object Library is not listed, click Browse to locate the MsprjXX.olb file, which is in the folder where you have Microsoft Project installed. The default location is C:\Program Files\Microsoft Office\Office. Click OK to close the References dialog box. Then Use this code.

    Since you have not mentioned what you want to copy and where exactly, i will give you a very basic code which you can then work on.

    '~~> Code to open MPP file in Excel
    Sub Sample()
        Dim appProj As MSProject.Application
        Dim aProg As MSProject.Project
        Dim wb As Workbook
        Dim ws As Worksheet
    
        Set wb = ActiveWorkbook
    
        '~~> This is the Sheet Where you want the data to be copied
        Set ws = wb.Sheets("Sheet1")
    
        Set appProj = CreateObject("Msproject.Application")
    
        '~~> This is a MS Project File. Change path as applicable.
        appProj.FileOpen "C:\MS Project.mpp"
    
        Set aProg = appProj.ActiveProject
    
        appProj.Visible = True
    
        '~~> Now you have the MPP file opened, rest of the code goes here
    End Sub
    

    prerna: Can u also provide me the tutorial to learn macros to be used in excel.It would be very helpful

    You can visit this link which is a good start. But ultimately, it all depends on how much you practice 🙂

    Topic: Record and use Excel macros

    Link: http://office.microsoft.com/en-us/excel-help/record-and-use-excel-macros-HA001054837.aspx

    More On Macros:

    http://www.excel-vba.com/

    http://www.excel-vba-easy.com/

    http://www.mrexcel.com/articles.shtml

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an excel sheet with data and want to export it to a
Intro: I have written some short excel macros (tested, they work fine) and want
How can an existing macro be inserted into a new excel workbook? I want
I am new to VBA in Excel. I'm setting up a simple macro Option
I'm new to textmate and I want to use it to write latex. I
Suppose I allow user to write his own variable calculation macro using a common
I am really new to excel macros and I was wondering if this was
I am writing a Macro in excel VBA that creates a data validation list
What I want to do is write some classes in C# in a new
I'm trying to write a Word macro which inserts data from the Current User

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.