+ Reply to Thread
Results 1 to 3 of 3

Macro copying only sheets' values without formula

Hybrid View

  1. #1
    Registered User
    Join Date
    06-26-2015
    Location
    italy
    MS-Off Ver
    Ms Office Professional Plus 2010
    Posts
    24

    Macro copying only sheets' values without formula

    Hello!!!
    How can I set this macro in order to get copied in the new file only the values of the sheets I need without the formula???
    This is the code:

    Sub SAVE_REPORT()
    
    Dim Path1 As String
    
    Path1 = "C:\DEV\REPORT FOLDER" & "\" & "REPORT" & Format(Now, " dd-mm-yyyy ")
    ActiveSheet.Unprotect Password:="report"
    Sheets("1").Unprotect Password:="report"
    Sheets("2").Unprotect Password:="report"
    Sheets("3").Unprotect Password:="report"
    Sheets("4").Unprotect Password:="report"
    Sheets(Array("SUMMARY", "1", "2", "3", "4")).Copy
        ActiveWorkbook.SaveAs Filename:=Path1, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
        Application.CopyObjectsWithCells = False
        ActiveWindow.Close
        ActiveSheet.Protect DrawingObjects:=True, _
    Contents:=True, Scenarios:=True, Password:="report"
    Sheets("1").Protect DrawingObjects:=True, _
    Contents:=True, Scenarios:=True, Password:="report"
    Sheets("2").Protect DrawingObjects:=True, _
    Contents:=True, Scenarios:=True, Password:="report"
    Sheets("3").Protect DrawingObjects:=True, _
    Contents:=True, Scenarios:=True, Password:="report"
    Sheets("4").Protect DrawingObjects:=True, _
    Contents:=True, Scenarios:=True, Password:="report"
    
    End Sub
    Can anybody please help me???
    Thx

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Macro copying only sheets' values without formula

    Sub SAVE_REPORT()
    
    Dim Path1 As String, ws As Worksheet
        
    Path1 = "C:\DEV\REPORT FOLDER" & "\" & "REPORT" & Format(Now, " dd-mm-yyyy ")
    ActiveSheet.Unprotect Password:="report"
    Sheets("1").Unprotect Password:="report"
    Sheets("2").Unprotect Password:="report"
    Sheets("3").Unprotect Password:="report"
    Sheets("4").Unprotect Password:="report"
    Sheets(Array("SUMMARY", "1", "2", "3", "4")).Copy
    For Each ws In ActiveWorkbook.Worksheets
        ws.UsedRange.Value = ws.UsedRange.Value
    Next ws
        ActiveWorkbook.SaveAs Filename:=Path1, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
        Application.CopyObjectsWithCells = False
        ActiveWindow.Close
        ActiveSheet.Protect DrawingObjects:=True, _
    Contents:=True, Scenarios:=True, Password:="report"
    Sheets("1").Protect DrawingObjects:=True, _
    Contents:=True, Scenarios:=True, Password:="report"
    Sheets("2").Protect DrawingObjects:=True, _
    Contents:=True, Scenarios:=True, Password:="report"
    Sheets("3").Protect DrawingObjects:=True, _
    Contents:=True, Scenarios:=True, Password:="report"
    Sheets("4").Protect DrawingObjects:=True, _
    Contents:=True, Scenarios:=True, Password:="report"
        
    End Sub
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    06-26-2015
    Location
    italy
    MS-Off Ver
    Ms Office Professional Plus 2010
    Posts
    24

    Re: Macro copying only sheets' values without formula

    Thank you so much AlphaFrog!!!! It works perfectly!!!

+ 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. Replies: 7
    Last Post: 07-29-2014, 11:10 AM
  2. Macro copying formula where i only want the values
    By fakafan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-10-2014, 10:43 PM
  3. Replies: 4
    Last Post: 11-12-2013, 05:52 AM
  4. Replies: 0
    Last Post: 11-08-2012, 01:07 PM
  5. MACRO for Copying specific values from multiple sheets
    By planetrisk in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-24-2012, 11:42 AM
  6. [SOLVED] Macro copying values and sheet names of all activated sheets
    By Rosixks in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-07-2011, 06:16 PM
  7. macro - copying values between two sheets
    By Wedge120 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-15-2008, 10:45 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