Thread: Sheet to close
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett Don Guillett is offline
external usenet poster
 
Posts: 10,124
Default Sheet to close


Activesheet.name=

try this simpler version
Sub CloseifMaster()
If ActiveSheet.Name = "Master" Then
With ActiveWorkbook
'one dot only
.Save
.Close
End With
End If
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"oldjay" wrote in message
...
Why won't this work?

oldjayo

Sub test()

Dim wsShtToSave As Worksheet
Set wsShtToSave = ActiveSheet
If wsShtToSave= "Master" Then
ActiveWorkbook.Save
ActiveWorkbook.Close
End If
End Sub