View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Marcus Analyst Marcus Analyst is offline
external usenet poster
 
Posts: 16
Default Apply macro to one sheet only

CLR, tried it both of these ways - name of the sheet is "current". Still
hiding rows in another sheet - is it that my macros are all in one module?
And if so, how do I put my macros into their own separate modules?

METHOD ONE:
Sub Auto_Open()
'
' Auto_Open Macro
' Hides rows 10-28 (Steps 2 and 3)
'
' Keyboard Shortcut: Ctrl+x
'
Sheets("Current").Activate
Rows("10:26").Select
Selection.EntireRow.Hidden = True
End Sub

METHOD TWO:
Sub Auto_Open()
'
' Auto_Open Macro
' Sheets("Current").Activate
' Hides rows 10-28 (Steps 2 and 3)
'
' Keyboard Shortcut: Ctrl+x
'
Rows("10:26").Select
Selection.EntireRow.Hidden = True
End Sub
--
Marc


"CLR" wrote:

Gary's Student just showed you.............insert this line above your "Hide
rows" line
substituting your sheet name for "Sheet2"

Sheets("Sheet2").Activate


Vaya con Dios,
Chuck, CABGx3



"Marcus Analyst" wrote:

Here is the code:

Sub Auto_Open()
'
' Auto_Open Macro
' Hides rows 10-28 (Steps 2 and 3)
'
' Keyboard Shortcut: Ctrl+x
'
Rows("10:26").Select
Selection.EntireRow.Hidden = True
End Sub
--
Marc


"CLR" wrote:

Post your code, someone will help..........

Vaya con Dios,
Chuck, CABGx3



"Marcus Analyst" wrote:

A macro I have written hides rows in one sheet. However, it also is hiding
the same rows in a different sheet. How do I get a macro to run in only one
sheet?
--
Marc