#1   Report Post  
Steved
 
Posts: n/a
Default SaveNClose

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.
  #2   Report Post  
Anne Troy
 
Posts: n/a
Default

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.



  #3   Report Post  
Steved
 
Posts: n/a
Default

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.




  #4   Report Post  
Bob Phillips
 
Posts: n/a
Default

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.






  #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.







Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sub SaveNClose() Steved Excel Worksheet Functions 2 July 11th 05 10:41 PM


All times are GMT +1. The time now is 03:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"