Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default Hide row(s) based on drop down selection

I need to hide rows based on a drop down selection. Example: if d5 (drop down
cell) = refund, then hide rows 33 through 36, else hide row 25.

For the life of me my macro didn't work.

Thanks
--
Maritza
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,123
Default Hide row(s) based on drop down selection

You can use the change event in the sheet module

Try this one

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("D5"), Target) Is Nothing Then
Range("A25,A33:A36").EntireRow.Hidden = False
If Target.Value = "refund" Then
Range("A33:A36").EntireRow.Hidden = True
Else
Range("A25").EntireRow.Hidden = True
End If
End If
End Sub


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Maritza" wrote in message ...
I need to hide rows based on a drop down selection. Example: if d5 (drop down
cell) = refund, then hide rows 33 through 36, else hide row 25.

For the life of me my macro didn't work.

Thanks
--
Maritza

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default Hide row(s) based on drop down selection

I copied and pasted your info, made changes to suit my ranges. But when I
select things from the drop down - nothing happens.

Where did I go wrong?
--
Maritza


"Ron de Bruin" wrote:

You can use the change event in the sheet module

Try this one

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("D5"), Target) Is Nothing Then
Range("A25,A33:A36").EntireRow.Hidden = False
If Target.Value = "refund" Then
Range("A33:A36").EntireRow.Hidden = True
Else
Range("A25").EntireRow.Hidden = True
End If
End If
End Sub


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Maritza" wrote in message ...
I need to hide rows based on a drop down selection. Example: if d5 (drop down
cell) = refund, then hide rows 33 through 36, else hide row 25.

For the life of me my macro didn't work.

Thanks
--
Maritza


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,123
Default Hide row(s) based on drop down selection

Hi Maritza

Do you copy it in the correct sheet module ?
Do you use a Data validation dropdown list in D5 ?

Do you use Excel 97 ?



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Maritza" wrote in message ...
I copied and pasted your info, made changes to suit my ranges. But when I
select things from the drop down - nothing happens.

Where did I go wrong?
--
Maritza


"Ron de Bruin" wrote:

You can use the change event in the sheet module

Try this one

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("D5"), Target) Is Nothing Then
Range("A25,A33:A36").EntireRow.Hidden = False
If Target.Value = "refund" Then
Range("A33:A36").EntireRow.Hidden = True
Else
Range("A25").EntireRow.Hidden = True
End If
End If
End Sub


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Maritza" wrote in message ...
I need to hide rows based on a drop down selection. Example: if d5 (drop down
cell) = refund, then hide rows 33 through 36, else hide row 25.

For the life of me my macro didn't work.

Thanks
--
Maritza


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default Hide row(s) based on drop down selection

I'm unsure whether it's in the correct sheet module.
Yes, I did use data validation for the dropdown list in D5.
I'm using Excel 2003
--
Maritza


"Ron de Bruin" wrote:

Hi Maritza

Do you copy it in the correct sheet module ?
Do you use a Data validation dropdown list in D5 ?

Do you use Excel 97 ?



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Maritza" wrote in message ...
I copied and pasted your info, made changes to suit my ranges. But when I
select things from the drop down - nothing happens.

Where did I go wrong?
--
Maritza


"Ron de Bruin" wrote:

You can use the change event in the sheet module

Try this one

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("D5"), Target) Is Nothing Then
Range("A25,A33:A36").EntireRow.Hidden = False
If Target.Value = "refund" Then
Range("A33:A36").EntireRow.Hidden = True
Else
Range("A25").EntireRow.Hidden = True
End If
End If
End Sub


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Maritza" wrote in message ...
I need to hide rows based on a drop down selection. Example: if d5 (drop down
cell) = refund, then hide rows 33 through 36, else hide row 25.

For the life of me my macro didn't work.

Thanks
--
Maritza




  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,123
Default Hide row(s) based on drop down selection

Hi Maritza

I'm unsure whether it's in the correct sheet module.

Right click the sheet tab and choose view code
Paste the code there
Alt q to go back to Excel

Now change the dropdown


Do you use Excel 97 ?


Excel 2003 is OK
Change event is not working in a Data validation cell in Excel 97



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Maritza" wrote in message ...
I'm unsure whether it's in the correct sheet module.
Yes, I did use data validation for the dropdown list in D5.
I'm using Excel 2003
--
Maritza


"Ron de Bruin" wrote:

Hi Maritza

Do you copy it in the correct sheet module ?
Do you use a Data validation dropdown list in D5 ?

Do you use Excel 97 ?



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Maritza" wrote in message ...
I copied and pasted your info, made changes to suit my ranges. But when I
select things from the drop down - nothing happens.

Where did I go wrong?
--
Maritza


"Ron de Bruin" wrote:

You can use the change event in the sheet module

Try this one

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("D5"), Target) Is Nothing Then
Range("A25,A33:A36").EntireRow.Hidden = False
If Target.Value = "refund" Then
Range("A33:A36").EntireRow.Hidden = True
Else
Range("A25").EntireRow.Hidden = True
End If
End If
End Sub


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Maritza" wrote in message ...
I need to hide rows based on a drop down selection. Example: if d5 (drop down
cell) = refund, then hide rows 33 through 36, else hide row 25.

For the life of me my macro didn't work.

Thanks
--
Maritza


  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default Hide row(s) based on drop down selection

Thank you! Got it to work including with sheet protection.
--
Maritza


"Ron de Bruin" wrote:

Hi Maritza

I'm unsure whether it's in the correct sheet module.

Right click the sheet tab and choose view code
Paste the code there
Alt q to go back to Excel

Now change the dropdown


Do you use Excel 97 ?


Excel 2003 is OK
Change event is not working in a Data validation cell in Excel 97



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Maritza" wrote in message ...
I'm unsure whether it's in the correct sheet module.
Yes, I did use data validation for the dropdown list in D5.
I'm using Excel 2003
--
Maritza


"Ron de Bruin" wrote:

Hi Maritza

Do you copy it in the correct sheet module ?
Do you use a Data validation dropdown list in D5 ?

Do you use Excel 97 ?



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Maritza" wrote in message ...
I copied and pasted your info, made changes to suit my ranges. But when I
select things from the drop down - nothing happens.

Where did I go wrong?
--
Maritza


"Ron de Bruin" wrote:

You can use the change event in the sheet module

Try this one

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("D5"), Target) Is Nothing Then
Range("A25,A33:A36").EntireRow.Hidden = False
If Target.Value = "refund" Then
Range("A33:A36").EntireRow.Hidden = True
Else
Range("A25").EntireRow.Hidden = True
End If
End If
End Sub


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Maritza" wrote in message ...
I need to hide rows based on a drop down selection. Example: if d5 (drop down
cell) = refund, then hide rows 33 through 36, else hide row 25.

For the life of me my macro didn't work.

Thanks
--
Maritza



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
Move entire row to another worksheet based on drop list selection Coyote Excel Worksheet Functions 0 February 2nd 07 05:52 PM
Change row colour based on the drop down selection Sathya Nallapeta Excel Discussion (Misc queries) 1 January 4th 07 11:12 PM
Auto populate several cells based on a selection from drop down li Sheldon Excel Discussion (Misc queries) 3 January 13th 06 08:12 PM
Drop Down Lists - assign a value based on selection Neil M Excel Worksheet Functions 6 November 19th 05 03:25 PM
need to populate several cells based on drop down menu selection TerriF Excel Discussion (Misc queries) 1 May 18th 05 10:27 PM


All times are GMT +1. The time now is 09:17 PM.

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"