Results 1 to 1 of 1

Macro copy data from folderpath to new workbook without open the folderpath

Threaded View

  1. #1
    Registered User
    Join Date
    02-23-2016
    Location
    Malaysia
    MS-Off Ver
    2007
    Posts
    13

    Macro copy data from folderpath to new workbook without open the folderpath

    Hi Everyone, can anyone teach me how to copy the data from the folderpath to new workbook without open the folderpath

    below is my current code
    Sub AAA()
        Application.ScreenUpdating = False
        Dim NewSheet As Workbook
        Dim FolderPath As String
        Dim NRow As Integer
        FolderPath = Application.GetOpenFilename(filefilter:="Excel Files (*.xl*), *.xl*")
        If FolderPath = "False" Then
            MsgBox "No file selected."
            Exit Sub
        End If
        Workbooks.Open (FolderPath)
        NRow = Range("F1").CurrentRegion.Rows.Count
        Columns("A:A").Select
        Selection.Delete Shift:=xlToLeft
        Columns("D:D").Select
        Selection.Delete Shift:=xlToLeft
        Columns("E:E").Select
        Selection.Delete Shift:=xlToLeft
        Columns("F:G").Select
        Selection.Delete Shift:=xlToLeft
        Columns("G:G").Select
        Selection.Delete Shift:=xlToLeft
        Columns("H:H").Select
        Selection.Delete Shift:=xlToLeft
        Columns("O:T").Select
        Selection.Delete Shift:=xlToLeft
        Columns("P:Q").Select
        Selection.Delete Shift:=xlToLeft
        Columns("Q:R").Select
        Selection.Delete Shift:=xlToLeft
        Columns("R:R").Select
        Selection.Delete Shift:=xlToLeft
        Columns("S:S").Select
        Selection.Delete Shift:=xlToLeft
        Columns("T:AK").Select
        Selection.Delete Shift:=xlToLeft
        Range("A1", "S" & NRow).Range("A1", "S" & NRow).Copy
        Workbooks.Add
        Range("A1", "S" & NRow).PasteSpecial
    End Sub
    Last edited by nspeng87; 09-12-2017 at 02:47 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Specify FolderPath from user-supplied value in cell
    By Jonny_XL in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-13-2016, 12:50 AM
  2. Macro to open workbook and copy data
    By CJ-22 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-19-2015, 05:49 PM
  3. [SOLVED] Macro to open a workbook and copy data
    By ScabbyDog in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-19-2012, 03:15 PM
  4. [SOLVED] Macro to copy data from open workbook to next open line of new workbook
    By nhtodd in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-11-2012, 09:42 PM
  5. [SOLVED] Return FolderPath to add attachment to email
    By rtcwlomax in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-13-2012, 06:01 AM
  6. Macro to copy data from other workbook - let user choose which open workbook
    By ssu95bm in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-12-2011, 11:17 AM
  7. Macro to open, copy data and rename from 1 workbook to another
    By granita1 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-21-2010, 04:32 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1