Activate event

  • Thread starter Thread starter Lynn
  • Start date Start date
L

Lynn

I would like a macro to run ONLY ONCE when SheetX is
activated. I would then like cell A1 on SheetX to be
selected. How do I get this to work so that the macro does
not keep running again and again when cell A1 on SheetX is
selected?
 
Private Sub Worksheet_Activate()
FdrExtract
Sheets("BOM & Price").Select
Range("A1").Select
End Sub

The problem occurs when sheet BOM & Price is
selected...the FdrExtract macro runs again and I end up in
an infinite loop.
 
Thanks Tom!
-----Original Message-----
In the sheet module at the top:

Dim bBlockcode as Boolean

Private Sub Worksheet_Activate()
if bBlockCode then exit sub
Range("A1").Select
bBlockCode = True
End If
End Sub

--
Regards,
Tom Ogilvy





.
 
Back
Top