Thread: Sheet to close
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Oldjay Oldjay is offline
external usenet poster
 
Posts: 337
Default Sheet to close

Thank I will use your code.
Can you tell me why mine didn't work?

"Mike H" wrote:

Hi,

Why not make it simpler

If ActiveSheet.Name = "Master" Then
ActiveWorkbook.Save
ActiveWorkbook.Close
End If

Mike

"oldjay" wrote:

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