Activate event

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?
 
L

Lynn

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.
 
L

Lynn

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





.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top