+ Reply to Thread
Results 1 to 8 of 8

Modifying existing code to save worksheet

Hybrid View

  1. #1
    Registered User
    Join Date
    12-18-2011
    Location
    New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Modifying existing code to save worksheet

    Thanks, works perfectly.

    Now what if I wanted to copy two seperate sheets to two different folders? Would i just replicate the code but insert

    Sheets("Sheet2").Select

    and also change

    FP = "C:\Test\" so it now reads FP="C:\Saved\"

  2. #2
    Registered User
    Join Date
    12-18-2011
    Location
    New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Modifying existing code to save worksheet

    Actually, think I have it sorted.

    Sub twosheetsave()
    Dim FP As String, dt As String, wbNam As String
    
    FP = "C:\Test\"
    wbNam = Range("d1").Value
    dt = Format(CStr(Now), "_hhmm_dd_mm_yyyy")
    
    ThisWorkbook.Sheets(3).Copy
    
    With ActiveWorkbook
        .SaveAs Filename:=FP & wbNam & dt & ".xls"
    
     End With
     
    FP = "C:\Saved\"
    wbNam = Range("j1").Value
    dt = Format(CStr(Now), "_hhmm_dd_mm_yyyy")
    
    ThisWorkbook.Sheets(2).Copy
    
    With ActiveWorkbook
        .SaveAs Filename:=FP & wbNam & dt & ".xls"
        .Close True
        
    End With
    
    End Sub

    Or is there a more efficient way to do this?

+ 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. Modifying existing code
    By rhouston08 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-13-2015, 06:03 PM
  2. [SOLVED] VBA code to save current worksheet as temporary PDF file and then add to my existing code
    By brianfromla in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-20-2014, 08:35 AM
  3. [SOLVED] Add two more columns, modifying an existing VBA code help.
    By Anka in forum Excel Programming / VBA / Macros
    Replies: 23
    Last Post: 02-17-2013, 01:24 PM
  4. Modifying existing VBA code to find different file name
    By PittsburghEng in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-03-2010, 03:24 PM
  5. Help modifying existing VBA code
    By camcafe in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-28-2008, 11:02 AM

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