A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Macro save workbook



 
 
Thread Tools Display Modes
  #1  
Old November 12th, 2009, 11:25 AM posted to microsoft.public.excel.misc
puiuluipui
external usenet poster
 
Posts: 467
Default Macro save workbook

Hi, i need a macro that will save workbook every time i select a cell in
another row.
Can this be done?
Thanks!
  #2  
Old November 12th, 2009, 11:53 AM posted to microsoft.public.excel.misc
Jacob Skaria
external usenet poster
 
Posts: 5,952
Default Macro save workbook

From workbook press Alt+F11 to launch VBE (Visual Basic Editor). From the
left treeview search for the workbook name and click on + to expand it.
Within that you should see the following

VBAProject(Your_Filename)
Microsoft Excel Objects
Sheet1(Sheet1)
Sheet2(Sheet2)
Sheet3(Sheet3)
This Workbook

Double click 'This WorkBook' and paste the below code to the right code pane.

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target
As Range)
Static lngRow As Long
If Target.Row lngRow Then Me.Save
lngRow = Target.Row
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"puiuluipui" wrote:

Hi, i need a macro that will save workbook every time i select a cell in
another row.
Can this be done?
Thanks!

  #3  
Old November 13th, 2009, 08:43 AM posted to microsoft.public.excel.misc
puiuluipui
external usenet poster
 
Posts: 467
Default Macro save workbook

You are the best! Thanks allot!

I have one more question....can this code be made to work every time i move
to another cell?

Thanks!

"Jacob Skaria" a scris:

From workbook press Alt+F11 to launch VBE (Visual Basic Editor). From the
left treeview search for the workbook name and click on + to expand it.
Within that you should see the following

VBAProject(Your_Filename)
Microsoft Excel Objects
Sheet1(Sheet1)
Sheet2(Sheet2)
Sheet3(Sheet3)
This Workbook

Double click 'This WorkBook' and paste the below code to the right code pane.

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target
As Range)
Static lngRow As Long
If Target.Row lngRow Then Me.Save
lngRow = Target.Row
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"puiuluipui" wrote:

Hi, i need a macro that will save workbook every time i select a cell in
another row.
Can this be done?
Thanks!

  #4  
Old November 13th, 2009, 04:40 PM posted to microsoft.public.excel.misc
Gord Dibben
external usenet poster
 
Posts: 20,252
Default Macro save workbook

Jacob's code as written requires you to select a cell in a different row
before the save takes place.

Do you want to save when you select anywhere on any worksheet?

Private Sub Workbook_SheetSelectionChange(ByVal Sh As _
Object, ByVal Target As Range)
Me.Save
End Sub

Seems a little excessive to me.


Gord Dibben MS Excel MVP

On Fri, 13 Nov 2009 00:43:01 -0800, puiuluipui
wrote:

You are the best! Thanks allot!

I have one more question....can this code be made to work every time i move
to another cell?

Thanks!

"Jacob Skaria" a scris:

From workbook press Alt+F11 to launch VBE (Visual Basic Editor). From the
left treeview search for the workbook name and click on + to expand it.
Within that you should see the following

VBAProject(Your_Filename)
Microsoft Excel Objects
Sheet1(Sheet1)
Sheet2(Sheet2)
Sheet3(Sheet3)
This Workbook

Double click 'This WorkBook' and paste the below code to the right code pane.

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target
As Range)
Static lngRow As Long
If Target.Row lngRow Then Me.Save
lngRow = Target.Row
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"puiuluipui" wrote:

Hi, i need a macro that will save workbook every time i select a cell in
another row.
Can this be done?
Thanks!


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:09 PM.


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