Hi All-
I have a macro that I currently use to save and value out a worksheet to a new workbook. I need some help in adjusting the macro to only value out columns with specific headers in row 24. For example: if the row headers say either "cost", "revenue", and "profit" (no matter what column), I would like to the macro to only value out those columns when saving the worksheet out to a new workbook.
Please help!!
Below is the current code:
Sub savePSh()
Dim sh As Worksheet
ActiveWorkbook.Sheets("P&L").Copy
Set sh = ActiveWorkbook.Sheets(1)
sh.Name = sh.Range("E6") & "_" & Format(Date, "yyyy mm dd")
With sh.UsedRange.Cells
.Value = .Value
End With
ActiveWorkbook.SaveAs "c:\" & sh.Range("E6") & "_" & Format(Date, "yyyy mm dd")
ActiveWorkbook.Close False
End Sub
I have a macro that I currently use to save and value out a worksheet to a new workbook. I need some help in adjusting the macro to only value out columns with specific headers in row 24. For example: if the row headers say either "cost", "revenue", and "profit" (no matter what column), I would like to the macro to only value out those columns when saving the worksheet out to a new workbook.
Please help!!
Below is the current code:
Sub savePSh()
Dim sh As Worksheet
ActiveWorkbook.Sheets("P&L").Copy
Set sh = ActiveWorkbook.Sheets(1)
sh.Name = sh.Range("E6") & "_" & Format(Date, "yyyy mm dd")
With sh.UsedRange.Cells
.Value = .Value
End With
ActiveWorkbook.SaveAs "c:\" & sh.Range("E6") & "_" & Format(Date, "yyyy mm dd")
ActiveWorkbook.Close False
End Sub