PDA

View Full Version : Solved: Change to variable



thomas.szwed
09-10-2008, 02:50 AM
Hi there,

How can i change the following so that instead of saving my whole workbook, it just saves a specific sheet? The sheet i want to save varies though but is identified in my variable sSheetName.

ActiveWorkbook.SaveAs Filename

Dim sSheetName As String

On Error Resume Next
sSheetName = Application.VLookup(Range("K10").Value, Range("F117:G125"), 2, False)
On Error GoTo 0


Thanks

Bob Phillips
09-10-2008, 02:55 AM
Dim sSheetName As String

On Error Resume Next
sSheetName = Application.VLookup(Range("K10").Value, Range("F117:G125"), 2, False)
On Error GoTo 0
Worksheets(sSheetName).Copy
ActiveWorkbook.SaveAs Filename