+ Reply to Thread
Results 1 to 3 of 3

new workbook needs to copy formulas and values not just values

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    03-04-2014
    Location
    calgary, canada
    MS-Off Ver
    Excel 2013
    Posts
    108

    new workbook needs to copy formulas and values not just values

    Hi guys,

    what do i need to change in this code to have the new workbook copy over formulas and formatting, not values. if someone can advise that would be great

    Mark

    'create weekly sheet for individual store
    
    Option Explicit
    Const fPATH As String = "C:\users\mark\desktop\"     'remember the final \ in this string
     
    Sub ExportActiveSheet()
    Dim wbNEW As Workbook
     
    On Error Resume Next
    Application.ScreenUpdating = False
    Application.DisplayAlerts = False
     
    ActiveSheet.Copy
    Set wbNEW = ActiveWorkbook
     
    With wbNEW.Sheets(1)
        .Range("A1:Z200").Value = .Range("A1:Z200").Value
        .Range("").Hidden = True
        wbNEW.SaveAs fPATH & "Weekly Sales - " & .[B4].Value & ".xlsx", 51
    End With
     
    wbNEW.Close False
    Application.ScreenUpdating = True
    MsgBox "Saved"
    End Sub

  2. #2
    Forum Contributor
    Join Date
    09-26-2014
    Location
    Moscow, Russia
    MS-Off Ver
    MSE 10, MSE 13
    Posts
    179

    Re: new workbook needs to copy formulas and values not just values

    Good time of day, WinWall!

    As I see, your code fills new sheet with it's own values to annihilate formulas. I think if you will just replace this row, you may get what you want:

    .Range("A1:Z200").Value = .Range("A1:Z200").Value
    Last edited by Rioran; 12-22-2014 at 10:52 AM. Reason: Grammar
    Best wishes and have a nice day!

  3. #3
    Forum Contributor
    Join Date
    03-04-2014
    Location
    calgary, canada
    MS-Off Ver
    Excel 2013
    Posts
    108

    Re: new workbook needs to copy formulas and values not just values

    i just played with it and replaced the .value with formulas on that row and it worked like a charm.

    Mark

+ 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 paste values to another workbook based on multiple cell values
    By Bazinga in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-23-2014, 12:41 PM
  2. [SOLVED] Copy range to new workbook w/some cells as values & some cells as formulas in new workbook
    By happydayze in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-14-2013, 12:42 PM
  3. Replies: 2
    Last Post: 07-12-2013, 02:34 AM
  4. [SOLVED] Copy Values From Each Workbook in Folder to a Single Sheet in New Workbook +Workbook names
    By Arsham24 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-21-2012, 07:42 PM
  5. Copy Values from WorkSheet back to Another Workbook Replacing Values in Worksheet
    By bobwilson in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-03-2006, 04:50 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