• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Add on to a Macro

Tom90

Member
I have a simple marco to copy about 6 sheets from my master file into a new workbook and rename the workbook along with paste special values the content of my 5 sheets, as I don't want the formulas left in the new workbook, but there is one of my sheet that I do need to leave the formulas in as it is working with Data Validation and lookup, I am at a lost on how to add this to the macro,
As you can see from below it is taking all the sheets and putting them into a new workbook obtaining the name from one of the other sheets and from Cell R1 then pasting then as values but I also what another sheet in the Master file called "Weekly Data" to move along with the macro but I want to retain the formula in it as it has data Validation,

Hope I have explained it ok and someone can help

Tom90


Code:
Sub New_KIP()
Dim Fname As String, ws As Worksheet
Fname = Sheets("Hours").Range("R1").Value
Sheets(Array("Info", "KPI Weekly", "KPI Monthly_YTD", "OM-KPI Monthly_YTD", "Q Data", "Weekly %")).Copy
For Each ws In ActiveWorkbook.Worksheets
With ws.UsedRange
.Value = .Value

End With
Next ws
With ActiveWorkbook
.SaveAs Filename:=Fname
.Close
End With

End Sub



MOVED BY MOD.
 
Last edited by a moderator:
Code:
Sub New_KIP()
Dim Fname As String, ws As Worksheet
Fname = Sheets("Hours").Range("R1").Value
Sheets(Array("Info", "KPI Weekly", "KPI Monthly_YTD", "OM-KPI Monthly_YTD", "Q Data", "Weekly %")).Copy
For Each ws In ActiveWorkbook.Worksheets
  If ws.Name <> "Weekly Data" Then
  With ws.UsedRange
  .Value = .Value
  End With
  End If
Next ws
With ActiveWorkbook
  .SaveAs Filename:=Fname
  .Close
End With

End Sub
 
Back
Top