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
Can this be done?
Thanks!
> Can this macro be made to save only active sheet?
No. That's not an option in Excel. So if your finding it necessary to save
every time you change row!! then it's the entire workbook. Have you
considered saving less frequently?
Mike
"Mike H" a scris:
You can do this which now saves every 5 changes of row.
Increase this number to reduce the frequency of save
If TimesSaved > 4 Then
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target
As Range)
Static lngRow As Long
Static TimesSaved As Long
If Target.Row <> lngRow Then
TimesSaved = TimesSaved + 1
End If
If TimesSaved > 4 Then
Me.Save
TimesSaved = 0
End If
lngRow = Target.Row
End Sub
Mike
The following will save every 5 rows.
Switching Calculation mode to manual before saving, should speed up the
process.
First though, go to Tools>Options>Calculation>set to Manual and Uncheck
Calculate before Save, then switch back to Automatic>OK
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Static lngRow As Long
If lngRow < 5 Then lngRow = 5
If Target.Row = lngRow Then
Application.Calculation = xlCalculationManual
ThisWorkbook.Save
Application.Calculation = xlCalculationAutomatic
lngRow = lngRow + 5
End If
End Sub
--
Regards
Roger Govier
"puiuluipui" <puiul...@discussions.microsoft.com> wrote in message
news:3537253D-F195-414B...@microsoft.com...
> __________ Information from ESET Smart Security, version of virus
> signature database 4742 (20100104) __________
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>
>
>
__________ Information from ESET Smart Security, version of virus signature database 4742 (20100104) __________
The message was checked by ESET Smart Security.
"Roger Govier" a scris:
> .
>
No, as I said, after unchecking, switch back to Automatic before clicking
OK.
Calculations will occur automatically as they do at present.
The code will switch calculation mode to Manual, just to speed up the Save
(as you said it was very slow), and then will switch back to Automatic again
immediately after the Save has been made.
--
Regards
Roger Govier
"puiuluipui" <puiul...@discussions.microsoft.com> wrote in message
news:017B1CA8-70E8-4B75...@microsoft.com...
> signature database 4744 (20100105) __________
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>
>
>
__________ Information from ESET Smart Security, version of virus signature database 4744 (20100105) __________