+ Reply to Thread
Results 1 to 2 of 2

Simple Open Workbook, Copy Sheet, Paste In New Workbook Question

Hybrid View

  1. #1
    Registered User
    Join Date
    06-05-2013
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    39

    Simple Open Workbook, Copy Sheet, Paste In New Workbook Question

    I need a macro that will be able to do the following. I keep trying to come up with something but it keeps having bugs. I feel like it'd be easier to ask an expert to simply come up with one than reevaluate mine. Which I can attach if needed.

    Macro needs to:
    1) Open a new sheet in xl workbook
    2) Then ask user to select an Excel Binary Worksheet to open (which has a password (how do i integrate it to automatically enter the password?), and then copy a sheet entitled "Current" within this worksheet
    3) Next, paste the "Current" sheet into the new workbook we made in Step 1 (into Sheet2) and change it's name to "Previous"

    That's all I need. Thank you!

  2. #2
    Registered User
    Join Date
    06-05-2013
    Location
    New York
    MS-Off Ver
    Excel 2010
    Posts
    39

    Re: Simple Open Workbook, Copy Sheet, Paste In New Workbook Question

    Here is the code I have currently which isn't working. This isn't like what I want it to be at all btw. The first post is a lot more what I want it to do.

    Sub NewPractice()
    FileToOpen = Application.GetOpenFilename _
    (Title:="Please Choose the RTCM File", _
    FileFilter:="Excel Binary Worksheet *.xlsb (*.xlsb),")
    
    If FileToOpen = False Then
        MsgBox "No file specified.", vbExclamation, "Duh!!!" ' Notification that nothing is chosen
        Exit Sub
    Else ' Load the file, copy the first sheet and paste it in active sheet ...
        ThisWorkbook.Activate
        ThisWorkbook.ActiveSheet.Range("A1:Z65536").ClearContents
        Workbooks(FileToOpen).Activate
        lrow = Workbooks(FileToOpen).Sheets("Sheet1").Cells(65536, 1).End(xlUp).Row
        Workbooks(FileToOpen).Sheets("Sheet1").Range("A1:Z" & lrow).Copy
        ThisWorkbook.Activate
        ThisWorkbook.ActiveSheet.Range("A1").PasteSpecial xlPasteValues
    End If
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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