Hide Rows via Dropdown List that is independent from each other.

SparkySparks

New Member
Joined
Jul 31, 2015
Messages
2
Good Day

Normally I do not just ask for solutions if I havent spent hours figuring it myself, but unfortunately I have run out of time and need some assistance.

I have a work book that is used for calculating costing for materials in manufacturing. I have headings for each type of material with a section with content, formulas etc for calculation purposes.

What I am looking for:

A VB code that allows me to use a drop down list with a "close" and "view" options (situated in column 4) next to each (material) heading to view or hide the selection. And if possible to in that section have the same.

For example under Material Heading 01: I want to see the associated costing section, I choose "view, that gives me 5 rows to enter data. Under the 5 Rows I have another drop down list that gives me the same type dropdown list option to view/close (hide/unhide if you will) X amount of rows should the user need to to enter extra rows of data.

Then continue the same process for Material Heading 02 / 03 / 04 and sub sections if required

In short I am looking to shorten the sections so that the user dont have to scroll themselves to death, and be able to manipulate the code to hide the number of rows as per my need (number of rows used for section). Each Hide, and Unhide dropdown should work independently from each other. Insofar most of the solutions I have seen is where people want to hide one thing and show another. This is not what i am looking for.

Can anyone help or point me in the right direction?

This is my first time working with VBA , however I know atleast how to createa drop down list lol
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Hello,

In Cells I1 and I2, I have Show and Hide.

The cells in Columns D, have Data Validation, with the Source as List from I1:I2.

Then this code needs to go into the relevant sheet code window.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Range("D:D")) Is Nothing Then
        Select Case Target.Value
        Case "Show"
            Rows(Target.Row + 1 & ":" & Target.Row + 4).Hidden = False
        Case "Hide"
            Rows(Target.Row + 1 & ":" & Target.Row + 4).Hidden = True
        End Select
    End If
End Sub

you may need to amend the 4.
 
Upvote 0
A friend suggested that I rather use a toggle button. I did and it works a charm and was painless

Thank you for coming back to me. I appreciate it.
 
Upvote 0

Forum statistics

Threads
1,214,601
Messages
6,120,467
Members
448,965
Latest member
grijken

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top