PC Review


Reply
Thread Tools Rate Thread

Determine if the sheet has been changed

 
 
Erik Wikström
Guest
Posts: n/a
 
      12th Dec 2007
I have a workbook where on one sheet the user can use a set of buttons and
dialogues to add new column headers to a table and then fill in the correct
default values for each row in that column. The headers shown are stored in
an internal datastructure and to ease insertion of new headers (which might
be inserted in the middle of the table) I have written code that first clears
all headers and then re-draws them whenever the user adds new headers. This
code is also run when the user opens the workbook.

The problem with this is that Excel counts this re-drawing (even if no
change is made) as changing the workbook, so if I just open the book and then
try to close it Excel asks if I want to save since the book has been changed.
So I wonder if it is possible to tell Excel to ignore changed to certain rows
when determining if the workbook has been changed.

--
Erik Wikström
 
Reply With Quote
 
 
 
 
Mike H
Guest
Posts: n/a
 
      12th Dec 2007
Hi,

You could do this:-

Private Sub Workbook_Open()
'Make your changes to headers etc
ActiveWorkbook.Saved = True
End Sub

Only changes made after the line
ActiveWorkbook.Saved = True
Should generate a prompt to save changes when closing.

Mike

"Erik Wikström" wrote:

> I have a workbook where on one sheet the user can use a set of buttons and
> dialogues to add new column headers to a table and then fill in the correct
> default values for each row in that column. The headers shown are stored in
> an internal datastructure and to ease insertion of new headers (which might
> be inserted in the middle of the table) I have written code that first clears
> all headers and then re-draws them whenever the user adds new headers. This
> code is also run when the user opens the workbook.
>
> The problem with this is that Excel counts this re-drawing (even if no
> change is made) as changing the workbook, so if I just open the book and then
> try to close it Excel asks if I want to save since the book has been changed.
> So I wonder if it is possible to tell Excel to ignore changed to certain rows
> when determining if the workbook has been changed.
>
> --
> Erik Wikström

 
Reply With Quote
 
Erik Wikström
Guest
Posts: n/a
 
      12th Dec 2007
"Mike H" wrote:
> "Erik Wikström" wrote:
>
> > I have a workbook where on one sheet the user can use a set of buttons and
> > dialogues to add new column headers to a table and then fill in the correct
> > default values for each row in that column. The headers shown are stored in
> > an internal datastructure and to ease insertion of new headers (which might
> > be inserted in the middle of the table) I have written code that first clears
> > all headers and then re-draws them whenever the user adds new headers. This
> > code is also run when the user opens the workbook.
> >
> > The problem with this is that Excel counts this re-drawing (even if no
> > change is made) as changing the workbook, so if I just open the book and then
> > try to close it Excel asks if I want to save since the book has been changed.
> > So I wonder if it is possible to tell Excel to ignore changed to certain rows
> > when determining if the workbook has been changed.
> >

> Hi,
>
> You could do this:-
>
> Private Sub Workbook_Open()
> 'Make your changes to headers etc
> ActiveWorkbook.Saved = True
> End Sub
>
> Only changes made after the line
> ActiveWorkbook.Saved = True
> Should generate a prompt to save changes when closing.


Hmm, that might work. Thanks.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Line count in 1 sheet to determine paste range in 2nd sheet. wpreqq99@yahoo.com Microsoft Excel Programming 0 26th Sep 2008 07:43 PM
Determine if dataset has changed Benj Nunez Microsoft C# .NET 2 7th Jan 2008 12:01 PM
in vba what command is used to determine if a particular cell on a particular sheet changed? some kind of event? how to get the old and new value of the cell? Daniel Microsoft Excel Worksheet Functions 1 23rd Jun 2005 07:53 PM
in vba what command is used to determine if a particular cell on a particular sheet changed? some kind of event? how to get the old and new value of the cell? Daniel Microsoft Excel Discussion 1 23rd Jun 2005 07:44 PM
Making subsequent sheets after sheet 1 copy sheet 1 when it is changed Tim Microsoft Excel Worksheet Functions 0 24th Sep 2003 06:25 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:52 PM.