Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

undo changes

  Asked By: Dylan    Date: Oct 05    Category: MS Office    Views: 536
  

Is it possible to undo changes done in a spreadsheet thru a macro
itself. Eg. If a for loop is updating some values in columb D based on
values in columns A,B & C. But if value in any cell is negative, loop
is to be terminated as well as changes done in column D also to be
undone.

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Lewis Welch     Answered On: Oct 05

Why not run a check BEFORE you start your loop?
Check to see if there are any negatives in your range. If so, you stop the
loop from making any changes thus you won't have to undo  anything. As an added
bonus, it will save running time on your macro.

Sub NegCheck()
ColumnMin = Application.WorksheetFunction.Min(Range("A1:C65536"))
If ColumnMin < 0 Then Exit Sub
End Sub

 
Answer #2    Answered By: Mike Stephens     Answered On: Oct 05

I was just not aware of using a function this way..........

 
Didn't find what you were looking for? Find more on undo changes Or get search suggestion and latest updates.




Tagged: