Munchkin;373278 said:
How do I automatically run this macro when the workseet is either opened
or
closed?
Rows("2:3").Select
Range("B2").Activate
Selection.EntireRow.Hidden = True
Rows("6:7").Select
Range("B6").Activate
Selection.EntireRow.Hidden = True
Range("C12").Select
End SubIf you really want to run the same macro on open and close then put the
code below in the ThisWorkbook module, to be honest you select objects
when you don't need to and they perform no action, you will probably
want error handling too!
Code:
--------------------
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Rows("2:3").Select
Range("B2").Activate
Selection.EntireRow.Hidden = True
Rows("6:7").Select
Range("B6").Activate
Selection.EntireRow.Hidden = True
Range("C12").Select
End Sub
Private Sub Workbook_Open()
Rows("2:3").Select
Range("B2").Activate
Selection.EntireRow.Hidden = True
Rows("6:7").Select
Range("B6").Activate
Selection.EntireRow.Hidden = True
Range("C12").Select
End Sub
--------------------
--
Simon Lloyd
Regards,
Simon Lloyd
'The Code Cage' (
http://www.thecodecage.com)