![]() |
Check a sheet each time file opened?
I have the following in my sheet command.
-------------------------------------------------- Option Explicit Private Sub Worksheet_Change(ByVal Target As Range) If Cells(7, 7).Value = "Processed" Then Range(Cells(6, 6), Cells(7, 7)).Select Selection.ClearContents End If MsgBox "event happened", vbExclamation End Sub ------------------------------------------------- It is to remove what is in cell 6,6 through 7,7 if in cell 7,7 it has "Processed". I have Excel 2002. It works when Excel is not open and you open the file from Explore. How can I get it to check each time the file is opened? Would checking every time the sheet is updated be too much and is that possible? I have tried using the "Application.EnableEvents" but found that I did not do it right and when I tested on office 2007 , it went into a loop and locked Excel. thanks in advance |
Check a sheet each time file opened?
You can put the code in Worksheet_Activate() so that it gets executed when
you activate the sheet... Worksheet_Activate() If Cells(7, 7).Value = "Processed" Then Range(Cells(6, 6), Cells(7, 7)).Select Selection.ClearContents End If MsgBox "event happened", vbExclamation End Sub "Don" wrote: I have the following in my sheet command. -------------------------------------------------- Option Explicit Private Sub Worksheet_Change(ByVal Target As Range) If Cells(7, 7).Value = "Processed" Then Range(Cells(6, 6), Cells(7, 7)).Select Selection.ClearContents End If MsgBox "event happened", vbExclamation End Sub ------------------------------------------------- It is to remove what is in cell 6,6 through 7,7 if in cell 7,7 it has "Processed". I have Excel 2002. It works when Excel is not open and you open the file from Explore. How can I get it to check each time the file is opened? Would checking every time the sheet is updated be too much and is that possible? I have tried using the "Application.EnableEvents" but found that I did not do it right and when I tested on office 2007 , it went into a loop and locked Excel. thanks in advance |
All times are GMT +1. The time now is 08:48 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com