Thread: SaveNClose
View Single Post
  #5   Report Post  
Steved
 
Posts: n/a
Default

Thankyou Bob

"Bob Phillips" wrote:

SteveD,

Try this

Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
Dim this As Worksheet
On Error GoTo wb_exit
Application.EnableEvents = False
Set this = ActiveSheet
Sh.Activate
Range("A5").Activate
this.Activate
wb_exit:
Application.EnableEvents = True
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Steved" wrote in message
...
Hello Anne from Steved

Need the cursor to be in Cell A5 when exiting a worksheet., for example if

I
am in sheet3 I need the macro to put the cursor in A5, also as present

goto
sheet1, put the cursor in A5 then save and close the file.


"Anne Troy" wrote:

I don't understand the question, Steved. Maybe someone else will, or

maybe
you could ask it in another way...just in case?
*******************
~Anne Troy

www.OfficeArticles.com


"Steved" wrote in message
...
Hello from Steved

Please if I am working in an other worksheets and I want it to goto A5
before it goes to A5 in Worksheet1 and saves what is required

Sub SaveNClose()
Application.Goto Reference:=Worksheets(1).Range("A5")
ActiveWorkbook.Close True
End Sub
Thankyou.