How to tell if a range or cell is dirty

C

Carl Rapson

Is there any way to tell if any of the cells in a range have been changed? I
have a VBA routine that allows the user to "auto-fill" a range of cells with
a certain value, but if any of the cells in the range have been modified but
not saved, I want to inform the user and (maybe) save the changes first. I
can't seem to find any property that indicates whether a range or a specific
cell has changed or not. Is there such a property, or maybe a way to compare
the current cell contents with the previous cell contents?

Thanks for any information,

Carl Rapson
 
T

Trevor Shuttleworth

Carl

?ThisWorkbook.Saved

This will return True if it has not been changed and False if it has.

Regards

Trevor
 
C

Carl Rapson

Thanks, I finally found that property, and it does help me somewhat.
However, that doesn't solve my main problem -- how can I tell if the cells
contained within a range have been changed? That way, I don't have to save
unless the cells I'm going to overwrite haven't been saved.

Thanks again,

Carl
 
T

Trevor Shuttleworth

Carl

you could use the Worksheet_Change event to set a flag if any of the cells
you are interested in get changed.

Regards

Trevor
 
C

Carl Rapson

Thanks, I guess that's what I'll have to do. I was just hoping there was a
built-in way of doing it.

Carl
 
Top