#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 184
Default Macro Help

I have recorded a macro to hid row 10. How would I automate this macro to
hide if E2 has yes and unhide if it has no?


Thank you

Jeremy
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Macro Help

Sub Mac()
Rows(10).Hidden = IIf(Range("E2") = "Yes", True, False)
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Jeremy" wrote:

I have recorded a macro to hid row 10. How would I automate this macro to
hide if E2 has yes and unhide if it has no?


Thank you

Jeremy

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 184
Default Macro Help

Can you help me with where to put this. Thank you for your response.



"Jacob Skaria" wrote:

Sub Mac()
Rows(10).Hidden = IIf(Range("E2") = "Yes", True, False)
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Jeremy" wrote:

I have recorded a macro to hid row 10. How would I automate this macro to
hide if E2 has yes and unhide if it has no?


Thank you

Jeremy

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 184
Default Macro Help

I have it working but you have to play the macro. How would you get the
macro to auto play?



"Jacob Skaria" wrote:

Sub Mac()
Rows(10).Hidden = IIf(Range("E2") = "Yes", True, False)
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Jeremy" wrote:

I have recorded a macro to hid row 10. How would I automate this macro to
hide if E2 has yes and unhide if it has no?


Thank you

Jeremy

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default Macro Help

Right click sheet tabview codeinsert this
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address < Range("e2").Address Then Exit Sub
If LCase(Target) = "yes" Then
Rows(10).Hidden = True
Else
Rows(10).Hidden = False
End If
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Jeremy" wrote in message
...
I have it working but you have to play the macro. How would you get the
macro to auto play?



"Jacob Skaria" wrote:

Sub Mac()
Rows(10).Hidden = IIf(Range("E2") = "Yes", True, False)
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Jeremy" wrote:

I have recorded a macro to hid row 10. How would I automate this macro
to
hide if E2 has yes and unhide if it has no?


Thank you

Jeremy




  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Macro Help

Right click the sheet tabView code and paste the below code and try

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Not Application.Intersect(Target, Range("E2")) Is Nothing Then
Rows(10).Hidden = IIf(Range("E2") = "Yes", True, False)
End If
Application.EnableEvents = True
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Jeremy" wrote:

I have it working but you have to play the macro. How would you get the
macro to auto play?



"Jacob Skaria" wrote:

Sub Mac()
Rows(10).Hidden = IIf(Range("E2") = "Yes", True, False)
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Jeremy" wrote:

I have recorded a macro to hid row 10. How would I automate this macro to
hide if E2 has yes and unhide if it has no?


Thank you

Jeremy

  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default Macro Help


If you always use Yes you can leave as is. But, if YES or yes or yEs then
change the one line.
Or, use mine instead.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Jeremy" wrote in message
...
Do I place this in the macro when I edit it?

"Don Guillett" wrote:

I had forgotten about I if. Minor tweaks
Private Sub Worksheet_Change(ByVal Target As Range)
'Application.EnableEvents = False' not necessary
If Not Application.Intersect(Target, Range("E2")) Is Nothing Then
Rows(10).Hidden = IIf(UCase(Range("E2")) = "YES", True, False)'spelling
End If
'Application.EnableEvents = True
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Jacob Skaria" wrote in message
...
Right click the sheet tabView code and paste the below code and try

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Not Application.Intersect(Target, Range("E2")) Is Nothing Then
Rows(10).Hidden = IIf(Range("E2") = "Yes", True, False)
End If
Application.EnableEvents = True
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Jeremy" wrote:

I have it working but you have to play the macro. How would you get
the
macro to auto play?



"Jacob Skaria" wrote:

Sub Mac()
Rows(10).Hidden = IIf(Range("E2") = "Yes", True, False)
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Jeremy" wrote:

I have recorded a macro to hid row 10. How would I automate this
macro to
hide if E2 has yes and unhide if it has no?


Thank you

Jeremy




  #10   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default Macro Help

Dont forget to set the Security level to low/medium in (Tools|Macro|Security)..

If this post helps click Yes
---------------
Jacob Skaria


"Jeremy" wrote:

Do I place this in the macro when I edit it?

"Don Guillett" wrote:

I had forgotten about I if. Minor tweaks
Private Sub Worksheet_Change(ByVal Target As Range)
'Application.EnableEvents = False' not necessary
If Not Application.Intersect(Target, Range("E2")) Is Nothing Then
Rows(10).Hidden = IIf(UCase(Range("E2")) = "YES", True, False)'spelling
End If
'Application.EnableEvents = True
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Jacob Skaria" wrote in message
...
Right click the sheet tabView code and paste the below code and try

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Not Application.Intersect(Target, Range("E2")) Is Nothing Then
Rows(10).Hidden = IIf(Range("E2") = "Yes", True, False)
End If
Application.EnableEvents = True
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Jeremy" wrote:

I have it working but you have to play the macro. How would you get the
macro to auto play?



"Jacob Skaria" wrote:

Sub Mac()
Rows(10).Hidden = IIf(Range("E2") = "Yes", True, False)
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Jeremy" wrote:

I have recorded a macro to hid row 10. How would I automate this
macro to
hide if E2 has yes and unhide if it has no?


Thank you

Jeremy



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 1 February 5th 07 09:31 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 3 February 5th 07 08:22 PM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 1 June 11th 05 12:44 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 0 June 10th 05 03:38 PM


All times are GMT +1. The time now is 02:40 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"