View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Cam[_2_] Cam[_2_] is offline
external usenet poster
 
Posts: 1
Default Save sheet when cell value changes

Well, its an internal thing and likely to be only one
user 'updating' at once so probably won't be an issue.
Sorry to be so dense but is this sub something i add to
the asp or excel? Where would it be added and how is it
called? i REALLY apreciate the help!!
-----Original Message-----
Cam.,

Haven't tried this as I don't have IIS and ASP on this

machine, but this
worksheet event code will force a save when a cell

changes, but what I don't
know is if your web update will force this event.

Private Sub Worksheet_Change(ByVal Target As Range)

Application.EnableEvents = False
On Error GoTo ws_exit
ThisWorkbook.Save

ws_exit:
Application.EnableEvents = True
End Sub


If you want to only do the updates on changes to certain

cells, try this mod
for example
Private Sub Worksheet_Change(ByVal Target As Range)

Application.EnableEvents = False
On Error GoTo ws_exit
If Not Intersect(Target, Range("A1:M100")) Is Nothing

Then
ThisWorkbook.Save
End If

ws_exit:
Application.EnableEvents = True
End Sub


What worries me is what happens if the web update flods

the page with
changes? Each cell change will trigger a workbook save,

and what happens to
the outstanding updates. Anyway, try it and see.

--

HTH

Bob Phillips

"Cam" wrote in message
...
OK, I have a workbook with several sheets, one sheet

takes
input from a .asp web page and updates other sheets

based
on the values. I DESPERATELY need to save the workbook
evertime a cell value changes (from the .asp web page
input) as currenlty the update occurs but will not save
before the next entry is made from the .asp page.

THANKS


.