Here's my code:
It works as expected. However, all sheets will not always exist. Sometimes individual sheets do not exist. How can I account for that?
Can this somehow include an IF(ISREF...) copy sheet1, sheet2, etc.? Not sure best way to accomplish. Ty in advance.
Code:
Function Export()
Dim Fname As String, ws As Worksheet
Fname = "Vesting Review - " & Sheets("Instructions").Range("D5").Value
Sheets(Array("VDR", "SP", "DDR", "VOR", "TDR")).Copy
For Each ws In ActiveWorkbook.Worksheets
With ws.UsedRange
.Value = .Value
End With
Next ws
With ActiveWorkbook
.SaveAs ThisWorkbook.Path & "\" & (Fname)
.Close
End With
End Function
It works as expected. However, all sheets will not always exist. Sometimes individual sheets do not exist. How can I account for that?
Can this somehow include an IF(ISREF...) copy sheet1, sheet2, etc.? Not sure best way to accomplish. Ty in advance.
Last edited: