View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ian_Cee Ian_Cee is offline
external usenet poster
 
Posts: 1
Default Macro to run on openinng worksheet

Does anyone know how to make a macro run automatically
when you open a worksheet, and not have to rely on
hitting a button or a shortcut key?

I want the sheet to flash a couple of times, so this is
the code:

' Keyboard Shortcut: Ctrl+y
'
Cells.Select
With Selection.Interior
.ColorIndex = 1
.Pattern = xlSolid
End With
Cells.Select
Selection.Interior.ColorIndex = xlNone
Range("A1").Select
Cells.Select
With Selection.Interior
.ColorIndex = 1
.Pattern = xlSolid
End With
Cells.Select
Selection.Interior.ColorIndex = xlNone
Range("A1").Select

Cells.Select
With Selection.Interior
.ColorIndex = 1
.Pattern = xlSolid
End With
Cells.Select
Selection.Interior.ColorIndex = xlNone
Range("A1").Select

Cells.Select
With Selection.Interior
.ColorIndex = 1
.Pattern = xlSolid
End With
Cells.Select
Selection.Interior.ColorIndex = xlNone
Range("A1").Select

End Sub


Cheers