MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Automating Macros


Posted by johno on November 12, 2001 6:22 AM

hello

i am working on a workbook which contains 6 sheets
valid, valid1, valid2
invalid, invalid1, invalid2

The valid2 and invalid2 are my final sheets and depend on calculations carried out in the respective sheets before them.

How do i carry out a macro on valid2 and invalid2 when they have been populated? surely using auto_open there is a chance that the macro will be performed without checking if the two final sheets have been populated with values????

please help....


Posted by Rick E on November 12, 2001 6:55 AM

Put a Macro in the Vaild2 worksheet for a change and check a cell that is filled in by the other functions when it is finished. In the example code the macro checks for cell A1 for a not empty condition.

Private Sub Worksheet_Change(ByVal Target As Range)
If Range("A1").Value <> "" Then

' code goes here....

End If
End Sub

So the last thing the other marcos do would be to put something in "A1" of the Valid3 sheet.