+ Reply to Thread
Results 1 to 4 of 4

Copy from worksheet to end of list on second worksheet

Hybrid View

  1. #1
    Registered User
    Join Date
    01-14-2011
    Location
    Gig Harbor, WA
    MS-Off Ver
    Excel 2010
    Posts
    24

    Copy from worksheet to end of list on second worksheet

    I would like to be able to copy a list of information I exported from a database into my worksheet I have developed to analyze the information. I already have a list of data in the worksheet but would like to add the new information to it. I need to be able to copy from the exported csv file and paste it to the end of the data that is already in my worksheet. Here is the code I have developed so far. Instead of copying A2:T1500 I would like to be able to copy "All data" and instead of pasting to B58 I'd like to paste to "first empty row".

    Sub ImportCSV()
    
        Dim fileName As Variant
        
        fileName = Application.GetOpenFilename(FileFilter:="CSV files, *.csv")
        If fileName <> False Then
            Workbooks.Open fileName
            Range("A2:T1500").Copy ThisWorkbook.ActiveSheet.Range("B58")
            ActiveWorkbook.Close SaveChanges:=False
        End If
    
    End Sub

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Copy from worksheet to end of list on second worksheet

    redkilner,

    Here's one way....
    Sub ImportCSV()
        
        On Error Resume Next
        With Workbooks.Open(Application.GetOpenFilename("CSV files, *.csv"))
            .Sheets(1).UsedRange.Offset(1).Copy ThisWorkbook.ActiveSheet.Cells(Rows.Count, "B").End(xlUp).Offset(1)
            .Close False
        End With
        On Error GoTo 0
        
    End Sub
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    01-14-2011
    Location
    Gig Harbor, WA
    MS-Off Ver
    Excel 2010
    Posts
    24

    Re: Copy from worksheet to end of list on second worksheet

    Works great! Thanks!

  4. #4
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Copy from worksheet to end of list on second worksheet

    You're very welcome

    If that takes care of your need, please mark this thread as solved.
    How to mark a thread Solved
    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word "Title" you will see a dropdown with the words "No prefix"
    Change to "Solved"
    Click Save

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Copy data from a worksheet and paste to worksheet with a similar worksheet name
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-21-2012, 04:02 AM
  2. Copy data from a worksheet and paste to worksheet with a similar worksheet name
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-21-2012, 02:49 AM
  3. Copy List of Userform Data to Worksheet
    By gsurge in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-22-2011, 10:15 AM
  4. Drop Down List to Copy Entire Contents of Worksheet into Master Worksheet
    By mrmartin in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-14-2011, 10:54 PM
  5. alphabetic list - copy each letter to different worksheet
    By Armitage2k in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-17-2010, 08:17 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